/** * @var array */public static $exitCodes = [// exception exit code 0 => ' OK ',// normal exit 1 => ' General error ',// general error 2 => ' Misuse of shell builtins ', // missing script 126 => ' Invoked command cannot execute ',// execute command error 127 => ' Command not found ',// command not found 128 => ' invalid exit Argument ',// input parameter exceptions // signals 129 => ' Hangup ',// uplink 130 => ' Interrupt ',// interrupt 131 => ' Quit and dump core ',// exit and print kernel 132 => ' IlLegal instruction ',// 133 => ' trace/breakpoint trap ', 134 => ' process aborted ', 135 => ' Bus error: "Access to undefined portion of memory object" ', 136 => ' floating point exception: ' erroneous arithmetic Operation "', 137 => ' kill (terminate immediately) ', 138 => ' user-defined 1 ', 139 => ' Segmentation violation ', 140 => ' user-defined 2 ', 141 => ' write to pipe with no one reading ', 142 => ' Signal raised by alarm ', 143 => ' termination (request to terminate) ', // 144 - not defined 145 => ' child process terminated, stopped (or continued*) ', 146 => ' continue if stopped ', 147 => ' Stop executing temporarily ', 148 => ' Terminal stop Signal ', 149 => ' background process attempting to read from tty ("in") ', 150 => ' background process attempting to write to tty ("Out") ', 151 => ' Urgent data available on socket ', 152 => ' CPU time limit exceeded ', 153 => ' file size limit Exceeded ', 154 => ' signal raised by timer counting virtual time: ' Virtual timer expired "', 155 => ' Profiling timer Expired ', // 156 - not defined 157 = > ' Pollable event ', // 158 - not defined 159 => ' Bad syscall ',];/** * construction method * @param string $commandline directives * @param string|null $cwd working directory * @param array |null $env Environment Variables * @param string|null $input input * @param int|float|null $timeout Time out * @param array $options proc_open Options * @throws \RuntimeException * @api */public function __construct ($commandline, $CWD = null, array $env = null, $input = null, $timeout = 60, array $options = []) {// commands Working directory environment variables input timeout options Array if (!function_exists (' Proc_open ')) {// if process handler function does not exist Error throw new \runtimeexception (' the Process class relies on proc_open, which is not available On your php installation. '); } $this->commandline = $commandline;// Directive $this->cwd = $CWD ;// catalogue if (null === $this->cwd && (defined (' Zend_thread_safe ') | | ' \ \ ' === ds) {// // If the directory is empty and Defined zend_thread_safe thread safety and not windos under $this->cwd = getcwd ();// by getting working directory way making get data } if (null !== $env) {// If environment variable not empty $this->setenv ($env);// set environment variable } $this->input = $input;// input Get $this SetTimeout ($timeout);// set time-out $this->usefilehandles & nbsp; = ' \ \ ' === DS;// whether to use text processing $this->pty = false;// status $this->enhancewindowscompatibility = true;// can execute window commands $this->enhancesigchildcompatibility = ' \ \ ' !== DS && $this->issigchildenabled ();// to execute subcommands $this->options = array_replace ([// option ' Suppress_errors ' => true, ' Binary_pipes ' = > true ], $options);} Constructors is The initialization of various functions public function __destruct ()// destructor { $this->stop ();} Public function __clone ()// copy function { $this->resetprocessdata ();} /** * running Instructions * @param callback|null $callback * @return int */ Public function run ($callback = null)// run function { $this Start ($callback); return $this->wait ();}
This article is from the "Focus on PHP Group number: 414194301" blog, please be sure to keep this source http://jingshanls.blog.51cto.com/3357095/1884579
[Li Jingshan php] every day tp5-20170120|thinkphp5-process.php-2