delano / rye

Safe, parallel access to Unix shells from Ruby
http://delano.github.com/rye
MIT License
234 stars 32 forks source link

Rye stdout not populated by the command stdout data #25

Closed rrepen closed 12 years ago

rrepen commented 12 years ago

From time to time I get this problem: The Rap object from the Rye command comes back with the exit status at zero and the error output empty but also the stdout. The error status indicates that no error arrived. I have not been able to have a case test for that but I found that the data are send to the stdout of the application instead of the Rap object;

Does this means that the Rap object is initialize/ready too late?

The shell command is a lustre one, "lfs df" which send back the lustre filesystem name and space used/free and a summary at the end for each lustre filesystems data line. I have also seen the stdout from the Rap object containing only the summary line .

So for the moment I have put this in a loop and re-do the command, which works on the second time.

If you need more details let me know. Thanks René

delano commented 12 years ago

Hmm, interesting. Try passing :debug => STDERR when initializing Rye::Box to see if that gives any more hints.

rrepen commented 12 years ago

Well now the loop I have runs fine.It may be due to the fact that I use the post_command_hook instead of the stdout_hook. But from the trace I use with DEBUG the problem seems to be in the net/ssh code and I can not reproduce it at will.

Related to that I have some requests to do about how Rye is handling the shell commands and ssh connections: 1) If I run the command "ps -C someprocess" it raises an exception if the process is not there, I just want to have an empty output and an exit_status of -1 so I know the process is not running and I can act 2) If the connection to a node fails it raises an exception. In box.rb the begin...rescue block is after the connect and I need to add rescue block around it to manage this situation. By moving the begin before the connect I can get the nice box.exception_hook= handle that cleanly and this allow to get a standard output when dealing with several nodes and simplify the result treatment.

Thanks René