in reply to Re^3: how to kill background process when script exit?
in thread how to kill background process when script exit?

ikegami,

I agree that it makes no sense to use it there, I was trying stuff out of desparation :-). It was interesting however the results that it did have, even though not what I ultimately want.

It seems the consensus is that using open() to launch the app should run it in the background, but it just does not seem to be what I experience. My code (in the perl script) does not continue to execute until the child process has quit.

  • Comment on Re^4: how to kill background process when script exit?

Replies are listed 'Best First'.
Re^5: how to kill background process when script exit?
by ikegami (Patriarch) on Feb 20, 2011 at 21:25 UTC
    Sorry, but you are mistaken.
    $ perl -E' say "".localtime; open my $fh, q{perl -e sleep |}; say "".localtime; ' Sun Feb 20 13:25:05 2011 Sun Feb 20 13:25:05 2011 [hung waiting for child to exit]

    or how about

    $ perl -E' open my $fh, q{perl -E'\''sleep 1; say STDERR "C"'\'' |}; say "P"; ' P C
      interesting...I agree with you (see my last reply to Corion), but when I run your second script I get this (no fooling):
      perl -e ' open my $fh, q{perl -e '\''sleep 1; print STDERR "C"'\'' |}; print "P"; ' CP
      (I couldn't use 'say', you must have a later version of perl than I?)

        say was introduced 4 years ago in 5.10.

        Buffering is delaying when you see the output.