Pastebin

Paste #466: proc_open

< previous paste - next paste>

Pasted by tdn

Download View as text

 36     $descriptorspec = array(
 37       0 => array("pipe", "r"),
 38       1 => array("pipe", "w"),
 39       2 => array("pipe", "w")
 40     );
 41
 42     $cwd = '/tmp';
 43
 44     $process = proc_open($command, $descriptorspec, $pipes, $cwd);
 45
 46     if (is_resource($process)) {
 47       fclose($pipes[0]);
 48       $run_result = stream_get_contents($pipes[1]);
 49       echo "############ RUN RESULT #################
 50
 51       $run_result
 52
 53 #################################";
 54       fclose($pipes[1]);
 55       $return_value = proc_close($process);
 56       echo "command returned $return_value\n";
 57     }

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.