Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] how to kill child processes when one exec spawn two processes

Expand Messages
  • merlyn@stonehenge.com
    ... david this should accomplish the same behaviour: david if (-e ./testfile ) { unlink ./testfile ; } Or even just: unlink testfile ; # and ignore the
    Message 1 of 4 , Jan 11, 2008
    • 0 Attachment
      >>>>> "david" == david wright <david_v_wright@...> writes:

      david> this should accomplish the same behaviour:
      david> if (-e "./testfile") { unlink "./testfile"; }

      Or even just:

      unlink "testfile"; # and ignore the error

      Or if you're scared of a weird error:

      unlink "testfile" or $! =~ /no such/i or die "rm testfile: $!";

      That way, if the "error" is not "no such file", you'll die reporting
      the error.

      Try to avoid creating race conditions deliberately. There's enough
      of them created accidentally. :)

      --
      Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
      See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    Your message has been successfully submitted and would be delivered to recipients shortly.