Class: Chukan::RemoteProcess
- Inherits:
-
LocalProcess
- Object
- LocalProcess
- Chukan::RemoteProcess
- Defined in:
- lib/chukan.rb
Instance Attribute Summary collapse
-
#rpid ⇒ Object
readonly
Returns the value of attribute rpid.
Attributes inherited from LocalProcess
#cmdline, #pid, #status, #stderr, #stdin, #stdout
Instance Method Summary collapse
-
#initialize(remote, *cmdline, &block) ⇒ RemoteProcess
constructor
A new instance of RemoteProcess.
- #signal(sig) ⇒ Object
Methods inherited from LocalProcess
#hup, #join, #kill, #set_display, #stderr_join, #stdout_join, #term
Constructor Details
#initialize(remote, *cmdline, &block) ⇒ RemoteProcess
Returns a new instance of RemoteProcess.
334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/chukan.rb', line 334 def initialize(remote, *cmdline, &block) @remote = remote cmdline_real = ["echo","$$","&&","exec"] + cmdline super(*remote.command(*cmdline_real), &block) @shortname = File.basename(cmdline.first.split(/\s/,2).first)[0, 7] + "@"+remote.host[0,5] stdout_join("\n") @rpid = stdout.gets.to_i end |
Instance Attribute Details
#rpid ⇒ Object (readonly)
Returns the value of attribute rpid.
346 347 348 |
# File 'lib/chukan.rb', line 346 def rpid @rpid end |
Instance Method Details
#signal(sig) ⇒ Object
348 349 350 351 |
# File 'lib/chukan.rb', line 348 def signal(sig) system(*@remote.command("kill -#{sig} #{@rpid}")) self end |