diff --git a/src/Runner/EvalRunner.php b/src/Runner/EvalRunner.php index bae430c..4d4ed43 100644 --- a/src/Runner/EvalRunner.php +++ b/src/Runner/EvalRunner.php @@ -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; diff --git a/src/Runner/RequireRunner.php b/src/Runner/RequireRunner.php index 1bf9f14..bb8fb34 100644 --- a/src/Runner/RequireRunner.php +++ b/src/Runner/RequireRunner.php @@ -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;