Skip to content

Commit

Permalink
Merge pull request #1442 from kevincerro/bugfix/console-bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli authored Mar 9, 2023
2 parents 71c2e37 + bb309e9 commit cc9124d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/layers/console/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ while (true) {

$timeout = max(1, $context->getRemainingTimeInMillis() / 1000 - 1);
$command = sprintf('/opt/bin/php %s %s 2>&1', $handlerFile, $cliOptions);
$process = Process::fromShellCommandline($command, null, ['LAMBDA_INVOCATION_CONTEXT' => json_encode($context)], null, $timeout);
if (\method_exists(Process::class, 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command, null, ['LAMBDA_INVOCATION_CONTEXT' => json_encode($context)], null, $timeout);
} else {
$process = new Process($command, null, ['LAMBDA_INVOCATION_CONTEXT' => json_encode($context)], null, $timeout);
}

$process->run(function ($type, $buffer) {
echo $buffer;
Expand Down

0 comments on commit cc9124d

Please sign in to comment.