Permalink
Browse files

Add 'sudo_opts' to Process to allow sudo options to be set for sudo c…

…ommands
  • Loading branch information...
1 parent 6756b6e commit 229e59550e77fe30277be3d956deadab0c7c1188 @noisebleed noisebleed committed Mar 16, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/NoiseLabs/ToolKit/Runner/Process.php
@@ -47,6 +47,9 @@ class Process implements ProcessInterface
* 'sudo':
* If TRUE, prepend every command with 'sudo'.
*
+ * 'sudo_opts':
+ * sudo options
+ *
* 'cwd':
* The initial working dir for the command. This must be an absolute
* directory path, or NULL if you want to use the default value (the
@@ -65,6 +68,7 @@ class Process implements ProcessInterface
*/
protected $_defaults = array(
'sudo' => false,
+ 'sudo_opts' => '-n', // non-interactive
'cwd' => null,
'env' => null,
'dry-run' => false
@@ -189,7 +193,7 @@ public function run()
// use sudo?
$command = (true === $this->settings->get('sudo', $this->_defaults['sudo'])) ?
- 'sudo '.$this->command : $this->command;
+ 'sudo '.$this->settings->get('sudo_opts', $this->_defaults['sudo_opts']).' '.$this->command : $this->command;
// current working directory
$cwd = $this->settings->get('cwd', $this->_defaults['cwd']);

0 comments on commit 229e595

Please sign in to comment.