How do I get the PTY.spawn child exit code?

后端 未结 3 1024
清酒与你
清酒与你 2021-02-10 02:27

I\'m trying to manage a SSH connection to a network device via the PTY module, with a code similar to this:

cmd_line = \"ssh coltrane@love.supreme.com\"
begin
          


        
3条回答
  •  忘了有多久
    2021-02-10 03:10

    In abstract: In Linux The parent should wait()s for this child to know the exit status of his child.
    C code:

    int status;
    wait(&status) // in the parent code part
    WEXITSTATUS(status) //macro to return the exit code of the returned child

    I'm sorry.I don't have experience with ruby to provide you with some code. Best wishes :)

提交回复
热议问题