Thread to handle an execute command and wait for output

Discussion in 'Ruby' started by Ruwan Budha, Apr 12, 2010.

  1. Ruwan Budha

    Ruwan Budha Guest

    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/.
    Ruwan Budha, Apr 12, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Cowald
    Replies:
    4
    Views:
    1,055
    Tohid
    Oct 23, 2003
  2. Huey

    How to make "fork/wait" to WAIT longer?

    Huey, Mar 1, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,965
    -berlin.de
    Mar 1, 2004
  3. Leon
    Replies:
    2
    Views:
    528
  4. James_Dean
    Replies:
    0
    Views:
    366
    James_Dean
    Nov 8, 2007
  5. black_13
    Replies:
    2
    Views:
    546
    Matt Nordhoff
    Feb 15, 2008
Loading...

Share This Page