This line is subtly wrong:
my $execTwo = "$command &> log ";

Well, that might depend on what type of shell we're talking about. In bash, the ampersand followed immediately by ">" is the "preferred" way to redirect both stdout and stderr to the named output file, while in a C-shell, you have to use the angle-bracket followed by the ampersand (and bash also supports this order -- who knows why bash doesn't "prefer" it...)

Anyway, another confounding factor is that the shell invoked by perl's "system()" call might not be the same as the user's login shell, so things that the user can do on the command line might not work in the system() call.

So, the idea that the command is being backgrounded as well as having stdout redirected is certainly plausible, maybe even likely; but it's also quite understandable that the OP thought he was doing things the right way. The point is: be very careful about system calls that use shell-dependent syntax, and avoid such things as much as possible.


In reply to Re^2: Different values when using $? to detect seg faults by graff
in thread Different values when using $? to detect seg faults by Gmong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.