[Scons-users] Eclipse-friendly compile error output
Geza Lore
geza.lore at broadcom.com
Fri Aug 22 08:09:13 EDT 2014
Hi,
You can filter the compiler output by doing something along these lines (I used this for colouring by piping through sed ...):
sedSP = subprocess.Popen([r'sed',
r'-e', env.subst(r's/.*\(^\|[^=]\b\)Err.*/${RED}${BOLD}&${PLAIN}/i', raw=1),
r'-e', env.subst(r's/.*\bWarn.*/${YELLOW}${BOLD}&${PLAIN}/i', raw=1)],
stdin=subprocess.PIPE)
sys.stdout = sedSP.stdin
sys.stderr = sedSP.stdin
# Make sure spawned command output is fed thorugh the SCons output, so it's piped to sed
def SpawnWrapper(pspawn):
def newSpawn(sh, escape, cmd, args, env):
return pspawn(sh, escape, cmd, args, env, sys.stdout, sys.stderr)
return newSpawn
env['SPAWN'] = SpawnWrapper(env['PSPAWN'])
If you want to keep stdout and stderr separate, then you can fork off 2 processes to filter them separately.
Bests,
Geza
From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Gary Oberbrunner
Sent: 22 August 2014 12:56 PM
To: SCons users mailing list
Subject: Re: [Scons-users] Eclipse-friendly compile error output
On Thu, Aug 21, 2014 at 10:50 PM, Will Rouesnel <w.rouesnel at gmail.com<mailto:w.rouesnel at gmail.com>> wrote:
Can I do the same for error message spew
from the compiler,
No, SCons does not handle or filter the compiler output (stdout, stderr). It just runs the commands.
--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140822/45a17621/attachment-0001.html>
More information about the Scons-users
mailing list