-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProcessWorker.php
More file actions
34 lines (30 loc) · 902 Bytes
/
ProcessWorker.php
File metadata and controls
34 lines (30 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Aternos\Taskmaster\Environment\Process;
use Aternos\Taskmaster\Worker\SocketWorker;
/**
* Class ProcessWorker
*
* The process worker starts the process runtime in a separate process using {@link proc_open()}.
* No extensions are required for this worker, and it should be available in all environments except
* those that explicitly block {@link proc_open()}.
*
* @see https://www.php.net/manual/en/function.proc-open.php
* @package Aternos\Taskmaster\Environment\Process
*/
class ProcessWorker extends SocketWorker
{
/**
* @return bool
*/
public static function isSupported(): bool
{
return function_exists("proc_open") && PHP_OS_FAMILY !== "Windows";
}
/**
* @return ProcessWorkerInstance
*/
public function createInstance(): ProcessWorkerInstance
{
return new ProcessWorkerInstance($this->options);
}
}