Permalink
Browse files

Provide a warning when disabling forking on every command in case of …

…missing pcntl.
  • Loading branch information...
adonohue
adonohue committed Oct 21, 2010
1 parent e03168c commit 8438f3f3536f34ce73405e23a6369dc0da6e66aa
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/phpsh.php
View
@@ -409,7 +409,13 @@ function __construct($output_from_includes='', $do_color, $do_autocomplete,
$this->__send_autocomplete_identifiers($do_autocomplete);
$this->do_color = $do_color;
$this->do_undefined_function_check = $do_undefined_function_check;
+ if (!PCNTL_EXISTS && $fork_every_command) {
+ $fork_every_command = false;
+ fwrite(STDERR,
+ "Install pcntl to enable forking on every command.\n");
+ }
$this->fork_every_command = $fork_every_command;
+
// now it's safe to send any output the includes generated
echo $output_from_includes;
fwrite($this->_comm_handle, "ready\n");
@@ -561,7 +567,7 @@ function interactive_loop() {
echo "\033[33m"; // yellow
}
- if (PCNTL_EXISTS and $this->fork_every_command) {
+ if ($this->fork_every_command) {
$parent_pid = posix_getpid();
$pid = pcntl_fork();
$evalue = null;

0 comments on commit 8438f3f

Please sign in to comment.