original_string: protected function runShell($command, &$stdout = '', &$stderr = '', $input = '')
      {
          $descriptorSpecs = [
              0 => ["pipe", "r"],
              1 => ["pipe", "w"],
              2 => ["pipe", "w"]
          ];
          // Invoke command
          $pipes = [];
          $proc = proc_open($command, $descriptorSpecs, $pipes);
  
          if (!is_resource($proc)) {
              return 255;
          }
  
          // Send content as input
          fwrite($pipes[0], $input);
          fclose($pipes[0]);
  
          // Get output
          $stdout = stream_get_contents($pipes[1]);
          fclose($pipes[1]);
          $stderr = stream_get_contents($pipes[2]);
          fclose($pipes[2]);
  
          // Get result
          return proc_close($proc);
      }
code: protected function runShell($command, &$stdout = '', &$stderr = '', $input = '')
      {
          $descriptorSpecs = [
              0 => ["pipe", "r"],
              1 => ["pipe", "w"],
              2 => ["pipe", "w"]
          ];
          // Invoke command
          $pipes = [];
          $proc = proc_open($command, $descriptorSpecs, $pipes);
  
          if (!is_resource($proc)) {
              return 255;
          }
  
          // Send content as input
          fwrite($pipes[0], $input);
          fclose($pipes[0]);
  
          // Get output
          $stdout = stream_get_contents($pipes[1]);
          fclose($pipes[1]);
          $stderr = stream_get_contents($pipes[2]);
          fclose($pipes[2]);
  
          // Get result
          return proc_close($proc);
      }
code_tokens: protected function runShell ( $ command , & $ stdout = '' , & $ stderr = '' , $ input = '' ) { $ descriptorSpecs = [ 0 => [ "pipe" , "r" ] , 1 => [ "pipe" , "w" ] , 2 => [ "pipe" , "w" ] ] ; // Invoke command $ pipes = [ ] ; $ proc = proc_open ( $ command , $ descriptorSpecs , $ pipes ) ; if ( ! is_resource ( $ proc ) ) { return 255 ; } // Send content as input fwrite ( $ pipes [ 0 ] , $ input ) ; fclose ( $ pipes [ 0 ] ) ; // Get output $ stdout = stream_get_contents ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 1 ] ) ; $ stderr = stream_get_contents ( $ pipes [ 2 ] ) ; fclose ( $ pipes [ 2 ] ) ; // Get result return proc_close ( $ proc ) ; }
docstring: Runs an arbitrary and safely escaped shell command
  
  @param  string $command Full command including arguments
  @param  string &$stdout Standand output
  @param  string &$stderr Standard error
  @param  string $input   Content to pass via standard input
  @return int Exit code.  0 is success
docstring_tokens: Runs an arbitrary and safely escaped shell command