[Scons-users] How to capture the compiler output

yjtyzw at 126.com
Thu Aug 1 20:33:52 EDT 2024


Hi Guys,




    Thanks every! With your help, I have capture the compiler output.

    I redefine env['SPAWN'],  and I need to hand the difference in path formats between Win and Linux.

    Cygwin is better than cmd.exe on Windows.



















At 2024-07-30 06:02:00, "Bill Deegan" <bill at baddogconsulting.com> wrote:

You could also redefine env['SPAWN']
https://scons.org/doc/production/HTML/scons-man.html#cv-SPAWN




On Mon, Jul 29, 2024 at 8:15 AM Mats Wichmann <mats at wichmann.us> wrote:

On 7/29/24 08:19, 于 wrote:
> Hi Guys,
>
> ‍I want to capture the compiler output, to get the warning and error
> counter.
> ‍I think I can redefinite the sys.write.stdout. So I did. And I can
> capture the scons command line, but I can't get compiler
> output(warning&error).
> ‍Then I find that compiler warning and error are print via
> sys.write.stderr, so I modify compiler argument, print all of compiler
> output via sys.write.stdout. But I can't get warning and error also.
> I know scons call compiler via subprocess, subprocess can get compiler
> output. But scons don't save compiler output.
> How can I capture compiler warning and error output via scons.

Your best bet today is to capture this *outside* of SCons. On a Linux
system, for example, you can use the "script" command to capture a
session, or you can redirect the SCons command itself, like:


script -c "scons target" BUILD.LOG
scons target 2>&1 | tee BUILD.LOG

Neither has a *direct* equivalent on Windows though you can still
capture the two output streams.

There have been several requests for this over the years - you can hunt
in the issue tracker  on GitHub and see a few of them - but the fact is,
SCons itself doesn't listen (1), so it doesn't *know* what the output
from external build commands are.


(1) there are a few exception... while running Configure() checks, SCons
uses a special setup to capture everything from those builds which it
uses in a special way, but in normal running, no.


_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20240802/37e7e5b2/attachment-0001.htm>


More information about the Scons-users mailing list