rob-revisited/ide/bin/ide-worker.php

18 lines
736 B
PHP

<?php
// A helper process of the JumPHP IDE (JumPHP\Ide\Async\WorkerPool): jobs as JSON lines on stdin, answers on stdout.
// Started by the IDE itself with the autoloader to use (JUMPHP_IDE_AUTOLOAD); in an exported IDE, through its own executable
// (tools/standalone-stub.php, JUMPHP_WORKER_SCRIPT).
$autoload = getenv('JUMPHP_IDE_AUTOLOAD');
if (!defined('JUMPHP_EXECUTABLE')) {
if (!is_string($autoload) || !is_file($autoload)) {
fwrite(STDERR, "ide-worker: JUMPHP_IDE_AUTOLOAD is not a file\n");
exit(70);
}
require $autoload;
}
$code = JumPHP\Ide\Async\Worker::serve(STDIN, STDOUT);
if (defined('JUMPHP_EXECUTABLE')) {
return $code; // the executable's stub exits with it
}
exit($code);