Backtick vs. system()

Hi,

I have problems with the difference between the system() call and a
backtick call command.

Everything work fine until I try to redirect the output of the script.

Ex.
puts ls
system(‘ls’)

A normal run is fine.
The redirected version with test.rb >test.log 2>&1 stops with
“bad file descriptor”.
If you try the command independent, you will see that system() causes
the problem.
Any hints?

I used system, due I can see the output during the run.
With puts ls it will be only visible at the end.

Thanks
Peter

Try using IO#popen instead.


Jeremy T.
[email protected]

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