diff --git a/src/Async.php b/src/Async.php index 6b66e93..bb1667b 100644 --- a/src/Async.php +++ b/src/Async.php @@ -46,15 +46,18 @@ public static function discard() * Input you want to execute the required parameters in function *

* @param string $phpBin You can specify the PHP path for asynchronous execution scripts. + * @param $cwd where to exec script * @param array $envs * @return $this */ - public function start($scriptname, $args = [], $phpBin = null, $envs = []) + public function start($scriptname, $args = [], $cwd = null, $phpBin = null, $envs = []) { if ($scriptname == 'callbackStub.php') { $cwd = __DIR__; } else { - $cwd = '.'; + if ($cwd === null) { + $cwd = '.'; + } if (!is_file($scriptname)) { throw new FileNotFoundException($scriptname." is not found"); } @@ -171,7 +174,5 @@ public function regCallback(callable $callback) } // todo add multi async execution like add()->add()->start(); - - }