Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 234166
Collapse All | Expand All

(-)/usr/bin/colorgcc (-15 / +14 lines)
Lines 221-237 Link Here
221
# Figure out which compiler to invoke based on our program name.
221
# Figure out which compiler to invoke based on our program name.
222
$0 =~ m%.*/(.*)$%;
222
$0 =~ m%.*/(.*)$%;
223
my $progName = $1 || $0;
223
my $progName = $1 || $0;
224
my $compiler_pid;
224
my $compiler;
225
225
226
# If called as "colorgcc", just filter STDIN to STDOUT.
226
# If called as "colorgcc", just filter STDIN to STDOUT.
227
if ($progName eq 'colorgcc')
227
if ($progName =~ m/^colorgcc[-0-9.]*(\.pl)?$/)
228
{
228
{
229
   open(GCCOUT, "<&STDIN");
229
   $compiler = 'gcc';
230
}
230
}
231
else
231
else
232
{
232
{
233
   # See if the user asked for a specific compiler.
233
   # See if the user asked for a specific compiler.
234
   my $compiler;
235
   if (!defined($compiler = $compilerPaths{$progName}))
234
   if (!defined($compiler = $compilerPaths{$progName}))
236
   {
235
   {
237
      # Find our wrapper dir on the PATH and tweak the PATH to remove
236
      # Find our wrapper dir on the PATH and tweak the PATH to remove
Lines 257-279 Link Here
257
      }
256
      }
258
      $compiler = $progName;
257
      $compiler = $progName;
259
   }
258
   }
259
}
260
260
261
   # Get the terminal type. 
261
# Get the terminal type. 
262
   my $terminal = $ENV{"TERM"} || "dumb";
262
my $terminal = $ENV{"TERM"} || "dumb";
263
263
264
   # If it's in the list of terminal types not to color, or if
264
# If it's in the list of terminal types not to color, or if
265
   # we're writing to something that's not a tty, don't do color.
265
# we're writing to something that's not a tty, don't do color.
266
   if (! -t STDOUT || $nocolor{$terminal})
266
if (! -t STDOUT || $nocolor{$terminal})
267
   {
267
{
268
      exec $compiler, @ARGV
268
      exec $compiler, @ARGV
269
	 or die("Couldn't exec");
269
	 or die("Couldn't exec");
270
   }
271
272
   # Keep the pid of the compiler process so we can get its return
273
   # code and use that as our return code.
274
   $compiler_pid = open3('<&STDIN', \*GCCOUT, \*GCCOUT, $compiler, @ARGV);
275
}
270
}
276
271
272
# Keep the pid of the compiler process so we can get its return
273
# code and use that as our return code.
274
my $compiler_pid = open3('<&STDIN', \*GCCOUT, \*GCCOUT, $compiler, @ARGV);
275
277
# Colorize the output from the compiler.
276
# Colorize the output from the compiler.
278
while(<GCCOUT>)
277
while(<GCCOUT>)
279
{
278
{

Return to bug 234166