Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Thread to handle an execute command and wait for output (http://www.velocityreviews.com/forums/t862451-thread-to-handle-an-execute-command-and-wait-for-output.html)

Ruwan Budha 04-12-2010 09:21 PM

Thread to handle an execute command and wait for output
 
Hi,

I am struggling to do following,

1. I want to execute a client on command line and wait for a
output....(myClient)

2. execute another command which will make the above client output
something....
(grabtest /VERSION)

3. Grab the output from the client....and do something....

I have following but it does not work....pls help.

a = Thread.new {
@cmdOut = @machine.operations.runCommand("/opt/nc/test/myClient -o
1");
Thread.pass;
print"@cmdOut = #{@cmdOut}"
}
b = Thread.new {
@machine2 = Machine.new(:D0, {:hostname => @hostname,
:logger => @log, :acquireDelay => @IDelay,
:markDelay => @markIDelay});

@cmdOut1 = @machine2.operations.runCommand("grabtest /VERSION");
print"@cmdOut1 = #{@cmdOut1}"
Thread.pass
}

b.join


Thanks in advance
--
Posted via http://www.ruby-forum.com/.



All times are GMT. The time now is 08:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.