1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-29 20:29:00 +01:00
This commit is contained in:
Daniil Gentili 2020-02-11 23:41:45 +01:00
parent a5d4270acb
commit 7ee97e2ef0
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 8 additions and 9 deletions

View File

@ -5,7 +5,6 @@ namespace Amp\Parallel\Context\Internal\Runner;
use Amp\ByteStream\ResourceOutputStream;
use Amp\Parallel\Context\ContextException;
use Amp\Parallel\Context\Internal\ProcessHub;
use Amp\Parallel\Context\Internal\Runner\RunnerAbstract;
use Amp\Promise;
use Amp\Success;
@ -33,7 +32,7 @@ final class WebRunner extends RunnerAbstract
private $running = false;
/**
* Socket
* Socket.
*
* @var ResourceOutputStream
*/
@ -59,7 +58,7 @@ final class WebRunner extends RunnerAbstract
if (\substr($uri, -1) === '/') { // http://example.com/path/ (assumed index.php)
$uri .= 'index'; // Add fake file name
}
$uri = str_replace('//', '/', $uri);
$uri = \str_replace('//', '/', $uri);
$rootDir = \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$rootDir = \end($rootDir)['file'] ?? '';
@ -106,7 +105,7 @@ final class WebRunner extends RunnerAbstract
if (!\is_array($script)) {
$script = [$script];
}
array_unshift($script, $hub->getUri());
\array_unshift($script, $hub->getUri());
$this->params = [
'cwd' => $cwd,
'env' => $env,

View File

@ -39,8 +39,8 @@ if (\function_exists("cli_set_process_title")) {
$fromWeb = false;
if (!isset($argv)) { // Running from web
$argv = $_REQUEST['argv'] ?? [];
array_unshift($argv, __DIR__);
$argc = count($argv);
\array_unshift($argv, __DIR__);
$argc = \count($argv);
$fromWeb = true;
@\ini_set('html_errors', 0);
@ -135,9 +135,9 @@ if (!isset($argv)) { // Running from web
if ($fromWeb) { // Set environment variables only after auth
if (isset($_REQUEST['cwd'])) {
chdir($_REQUEST['cwd']);
\chdir($_REQUEST['cwd']);
}
if (isset($_REQUEST['env']) && is_array($_REQUEST['env'])) {
if (isset($_REQUEST['env']) && \is_array($_REQUEST['env'])) {
foreach ($_REQUEST['env'] as $key => $value) {
@\putenv("$key=$value");
}