From: Matt Bleh Date: 2009-09-21T23:36:31+09:00 Subject: Re: Writing to STDOUT after closing controlling terminal David Masover wrote: > On Sunday 20 September 2009 08:49:56 pm Matt Bleh wrote: >> I know it's not enough justification, but doing an "echo 1" from a >> backgrounded bash script process doesn't kill the script. > > That's because your script is badly written. Try this script: > > #!/bin/sh > sleep 5 > echo hi || echo $! > output > > This has exactly the same behavior as your Ruby script, except that > you're > only capturing the return value of that first echo command. > > In other words: In a shell script (bash or otherwise), the 'echo' > command does > indeed get killed. It's just that by default, shell scripts ignore the > return > values, which means errors are silently eaten. Ruby, on the other hand, > raises > an exception when something goes wrong. Ok, I didn't realized that about the bash script. So, this means that this difference between ruby 1.8 and ruby 1.9 is a feature? I guess that I should then use nohup if I don't want to think about this issue when writing other Ruby programs. -- Posted via http://www.ruby-forum.com/.