This is for lazy people. Sometime when you compile your c/c++ program, you may get tons of errors, especially when you miss some include files or just start a new program. In this case the error messages just fly away quickly, and you get totally lost. Well, you may increase your buffer, you may redirect your output… but for people who are lazy like me, you want a script.
This script starts your make process thru open3, capturing all compiling errors, and dumping them to both screen and a file called error_log. If the error log is short, you can just view it on screen, otherwise vi the error_log.
#!/usr/bin/perl use IPC::Open3; use strict; use warnings; my $pid = open3(\*WRITER, \*READER, \*ERROR, "make"); open(ERROR_LOG, ">", "error_log"); while (my $line = <ERROR>) { print $line; print ERROR_LOG $line; } close(ERROR_LOG); waitpid($pid, 0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capturing compile errors
by Roger (Parson) on Nov 05, 2003 at 02:22 UTC | |
|
Re: capturing compile errors (with script(1))
by grinder (Bishop) on Nov 05, 2003 at 07:25 UTC |