Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Does <code>color_producing_script</code> change its behavior when it's used in a pipe? Try</p> <pre><code>color_producing_script | cat </code></pre> <p>at the command line. It may have an option to force color output even when it is.</p> <p>The Perl script, <code>colorgcc</code>, is specifically checking to see if output is to a non-tty and skipping the colorization if that's the case.</p> <pre><code># Get the terminal type. $terminal = $ENV{"TERM"} || "dumb"; # If it's in the list of terminal types not to color, or if # we're writing to something that's not a tty, don't do color. if (! -t STDOUT || $nocolor{$terminal}) { exec $compiler, @ARGV or die("Couldn't exec"); } </code></pre> <p><strong>Edit:</strong></p> <p>You could modify the script in one or more of the following ways:</p> <ul> <li>comment out the test and make it always produce color output</li> <li>add functionality to support reading an environment variable that sets whether to colorize</li> <li>add functionality to support a color-always option in the <code>~/.colorgccrc</code> configuration file</li> <li>add functionality to support a color-always command line option that you strip before passing the rest of the options to the compiler</li> </ul> <p>You could also use the <a href="http://expect.sourceforge.net/" rel="nofollow"><code>expect</code></a> script <a href="http://expect.sourceforge.net/example/unbuffer.man.html" rel="nofollow"><code>unbuffer</code></a> to create a pseudo-tty like this:</p> <pre><code>unbuffer gcc file.c | cat </code></pre> <p>(where <code>cat</code> is a standin recipient).</p> <p>All of this is based on using <code>colorgcc</code> from the command line. There should be analogs for doing similar things within a Perl script.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload