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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs