For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2007 > suppress system() STDERR and STDOUT (win and unix)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author suppress system() STDERR and STDOUT (win and unix)
Nik J

2007-01-10, 7:00 pm

I have system command I want to run, but I don't want the output
(neither STDERR nor STDOUT) and this perl script is used on windows and
unix.

system("command > /dev/null 2>&1") works on unix, but not on windows.

So is there a way to run "command" and suppress the output? with the
same code being used for windows and unix?

Backticks isn't an option because of the extremely large output from
"command" and I don't want perl doing extra work for no reason.

The current trick I'm using is similar to the above system statement
but I create a tempfile and unlink it after the system command, but
that just seems silly to do.

Thank you,
Perlmedian

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com