Class: Traut::Spawn
- Inherits:
-
Object
- Object
- Traut::Spawn
- Defined in:
- lib/traut/spawn.rb
Instance Method Summary collapse
-
#initialize(log) ⇒ Spawn
constructor
A new instance of Spawn.
- #spawn(uid, gid, command, payload, block) ⇒ Object
Constructor Details
#initialize(log) ⇒ Spawn
Returns a new instance of Spawn.
15 16 17 |
# File 'lib/traut/spawn.rb', line 15 def initialize(log) @log = log end |
Instance Method Details
#spawn(uid, gid, command, payload, block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/traut/spawn.rb', line 19 def spawn(uid, gid, command, payload, block) runas(uid, gid) do # Why do I use systemu? Have a look at this: ## http://stackoverflow.com/questions/8998097/how-do-i-close-eventmachine-systems-side-of-an-stdin-pipe status, stdout, stderr = systemu command, 0=>payload block.call(status, stdout, stderr) # If you have an answer for that, consider enabling the following code, # keeping in mind that you need to figure out a way to get stderr back # as well. # EM.system command, proc{ |p| msg(p, payload) } do |stdout,status| # @log.debug("#{stdout} :: #{status}") # end end end |