[Scons-users] SCONS -j12, console output is disordered

Mats Wichmann mats at wichmann.us
Sat Dec 23 14:29:06 EST 2023


On 12/23/23 11:33, Duane Ellis wrote:
> SCONS could –
> 
>                  Capture the output of each sub process in the standard way.
> 
>                  Ie: use “POPEN()” and COMMUNICATE with the sub process.
> 
>                     Thus the subprocess output goes to SCONS and SCONS 
> collects it in a buffer.

Yes, it could.  It even does so now in one very specific situation - 
while evaluating a Configure context.  However, even playing the game 
with pushing in the value of the PSPAWN construction variable in place 
of the SPAWN variable which is what the configure code does is not a 
full solution, as scons would actually have to be prepared to gather and 
do something with the output, which it currently isn't.

> 
>                      You might want to put a timeout on all sub 
> processes, ie: 5 minutes…
> 
>                      In case they output an error and want sometype of 
> input from the human to continue
> 
>                  Then once the subprocess has completed, (Exit success 
> or Exit Error)
> 
>                 The responsible runner thread would:
> 
>                        Lock the console (mutex) so other SCONS threads 
> cannot use it.
> 
>                        output stdout and stderr of the sub process
> 
>                        Unlock the console so other SCONS threads can use it.

This is the method the test runner uses - queues tests, has a pool of 
runners to run them, and when one finished it takes a lock before 
writing the collected output. But that's a different usecase... the test 
runner *knows* it needs to collect output, while SCons itself really 
isn't structured that way. Using logging could also do this, as it 
handles locking between threads internally (there's an experimental 
version of the test runner that does that).

It *can* be done, but would require some effort.


More information about the Scons-users mailing list