From: Matt Bleh on
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/.

From: David Masover on
On Monday 21 September 2009 09:36:31 am Matt Bleh wrote:
> So, this means that this difference between ruby 1.8 and ruby 1.9 is a
> feature?

In my opinion.

> I guess that I should then use nohup if I don't want to think about this
> issue when writing other Ruby programs.

Depends what you're using the output for. I would use some sort of logger, if
you can't count on stdout being redirected.

First  |  Prev  | 
Pages: 1 2
Prev: wxruby problem
Next: ruby-oci8 function