Skip to content

Commit

Permalink
When using local runners, set $_SERVER['argv'] (in addition to $argv)
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Dec 11, 2019
1 parent 3d9c1d5 commit c6df9c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Runner/EvalRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function run($autoloader, $scriptMetadata, $cliArgs) {
putenv('POGO_AUTOLOAD=' . $autoloader);
global $argv;
$oldArgv = $argv;
$argv = array_merge([$scriptMetadata->file], $cliArgs);
$code = "?" . ">" . pogo_script();
$argv = $_SERVER['argv'] = array_merge([$scriptMetadata->file], $cliArgs);
$code = "?" . ">" . \pogo_script();
eval($code);
$argv = $oldArgv;
$argv = $_SERVER['argv'] = $oldArgv;

// FIXME: how to detect exit code?
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/Runner/RequireRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function run($autoloader, $scriptMetadata, $cliArgs) {
putenv('POGO_AUTOLOAD=' . $autoloader);
global $argv;
$oldArgv = $argv;
$argv = array_merge([$scriptMetadata->file], $cliArgs);
$argv = $_SERVER['argv'] = array_merge([$scriptMetadata->file], $cliArgs);
require $scriptMetadata->file;
$argv = $oldArgv;
$argv = $_SERVER['argv'] = $oldArgv;

// FIXME: how to detect exit code?
return 0;
Expand Down

0 comments on commit c6df9c2

Please sign in to comment.