Thread to handle an execute command and wait for output

R

Ruwan Budha

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,158
Messages
2,570,882
Members
47,414
Latest member
djangoframe

Latest Threads

Top