comparison vendor/psy/psysh/src/ExecutionLoop/ProcessForker.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 5fb285c0d0e3
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
63 63
64 // Wait for a return value from the loop process. 64 // Wait for a return value from the loop process.
65 $read = [$down]; 65 $read = [$down];
66 $write = null; 66 $write = null;
67 $except = null; 67 $except = null;
68 if (stream_select($read, $write, $except, null) === false) { 68
69 throw new \RuntimeException('Error waiting for execution loop'); 69 do {
70 } 70 $n = @stream_select($read, $write, $except, null);
71
72 if ($n === 0) {
73 throw new \RuntimeException('Process timed out waiting for execution loop');
74 }
75
76 if ($n === false) {
77 $err = error_get_last();
78 if (!isset($err['message']) || stripos($err['message'], 'interrupted system call') === false) {
79 $msg = $err['message'] ?
80 sprintf('Error waiting for execution loop: %s', $err['message']) :
81 'Error waiting for execution loop';
82 throw new \RuntimeException($msg);
83 }
84 }
85 } while ($n < 1);
71 86
72 $content = stream_get_contents($down); 87 $content = stream_get_contents($down);
73 fclose($down); 88 fclose($down);
74 89
75 if ($content) { 90 if ($content) {