Skip to content

Commit

Permalink
Fix the bug that cannot work in vscode extensions (#5779)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Jun 1, 2023
1 parent d5c5d04 commit e660ba6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions co-phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ if (isset($options['prepend'])) {
require $options['prepend'];
}
unset($options);
if (!isset(getopt('', ['prepend:'])['prepend'])) {
(function () {
$prepend = null;
foreach ($_SERVER['argv'] as $index => $argv) {
// --prepend /path/to/file
if ($argv === '--prepend') {
$prepend = $_SERVER['argv'][$index + 1] ?? null;
break;
}
// --prepend=/path/to/file
if (strpos($argv, '--prepend=') === 0) {
$prepend = substr($argv, 10);
break;
}
}
if ($prepend !== null && file_exists($prepend)) {
require $prepend;
}
})();
}
require PHPUNIT_COMPOSER_INSTALL;
$code = 0;
Swoole\Coroutine::set(['hook_flags' => SWOOLE_HOOK_ALL, 'exit_condition' => function () {
Expand Down

0 comments on commit e660ba6

Please sign in to comment.