in reply to system() Creating Different Results than Commandline Operation.

One problem, maybe unrelated to your symptoms but a problem anyway, is that '/dev/null' doesn't exist on windows.

A simple system( "gcov c:/path/to/file.gcda -o relative/path/to/source -b 2>&1 >nul" ); would achieve your goal without all the faffing around.

If you're wedded to rolling your own redirection, then what do you get if you try:

$gcov_error = system_no_output( 1, 'perl.exe', '-le"print qq[>$_<] for @ARGV"' $da_filename, "-o", $object_dir, "-b" );

The idea being to isolate whether it is the arguments being passed to the executable that are being screwed with, or the command itself that is misinterpreting them.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: system() Creating Different Results than Commandline Operation.
by kazeits (Initiate) on Apr 06, 2009 at 18:14 UTC
    I tried the code below however I am unsure what I should be getting out of it. nothing is being printed out and I fear its due to the very nature of system_no_output.
    $gcov_error = system_no_output( 1, 'perl.exe', '-le"print qq[>$_<] for @ARGV"' $da_filename, "-o", $object_dir, "-b" );
    I have no preference one way or the other of how the command executed. system_no_output is merely code I am trying to port at the moment.