How to make system () without relaying stdout in perl

How can I do perl make

System ("xcodebuild");

only relay stderr, not stdout. (xcodebuild has a huge amount of verbosity that I want to get rid of, but when something goes wrong, I still want to know what it was)

+5
source share
2 answers

Redirect standard output to /dev/null:

system("xcodebuild >/dev/null") == 0
  or warn "$0: xcodebuild exited " . ($? >> 8) . "\n";
+5
source
system("xcodebuild >> /dev/null");

... assuming, of course, that you get all the stderr stuff with your current syscall mechanism. Otherwise, you will need to redirect stdout to devnull and stderr to stdout.

+2
source

All Articles