37af06ab97801f3022a7e447eb3acb45daafb945
[packages/precise/mcollective.git] / lib / mcollective / vendor / systemu / samples / a.rb
1 #
2 # systemu can be used on any platform to return status, stdout, and stderr of
3 # any command.  unlike other methods like open3/popen4 there is zero danger of
4 # full pipes or threading issues hanging your process or subprocess.
5 #
6   require 'systemu'
7
8   date = %q( ruby -e"  t = Time.now; STDOUT.puts t; STDERR.puts t  " )
9
10   status, stdout, stderr = systemu date
11   p [ status, stdout, stderr ]