| Class | MCollective::Shell |
| In: |
lib/mcollective/shell.rb
|
| Parent: | Object |
Wrapper around systemu that handles executing of system commands in a way that makes stdout, stderr and status available. Supports timeouts and sets a default sane environment.
s = Shell.new("date", opts)
s.runcommand
puts s.stdout
puts s.stderr
puts s.status.exitstatus
Options hash can have:
cwd - the working directory the command will be run from
stdin - a string that will be sent to stdin of the program
stdout - a variable that will receive stdout, must support <<
stderr - a variable that will receive stdin, must support <<
environment - the shell environment, defaults to include LC_ALL=C
set to nil to clear the environment even of LC_ALL
timeout - a timeout in seconds after which the subprocess is killed,
the special value :on_thread_exit kills the subprocess
when the invoking thread (typically the agent) has ended
| command | [R] | |
| cwd | [R] | |
| environment | [R] | |
| status | [R] | |
| stderr | [R] | |
| stdin | [R] | |
| stdout | [R] | |
| timeout | [R] |