[Scons-users] Trying to use Execute()
Tom Tanner (BLOOMBERG/ LONDON)
ttanner2 at bloomberg.net
Fri Nov 22 10:19:25 EST 2013
To be honest whenever I've needed to filter the output I've normally done a wrapper script which executes the rest of the command line with a pipe, and if it succeeds, examine the output.
Thus instead of
Execute('some_function with argument')
i'd run
Execute('wrapper some_function with argument')
where wrapper would be something like (untested off the top of my head perl):
#!/usr/bin/env perl
my $res = open '-|', PIPE, @ARGV or die "Failed to run @ARGV\n";
while (<PIPE>) { ... }
close PIPE or die "Unexpected error running @ARGV\n";
----- Original Message -----
From: matias.iturburu at tallertechnologies.com
To: Tom Tanner (BLOOMBERG/ LONDON), scons-users at scons.org
At: Nov 22 2013 15:10:04
2013/11/22 Tom Tanner (BLOOMBERG/ LONDON) <ttanner2 at bloomberg.net>
Can't you try using env['PSPAWN'] - there's a builder which does that (I forget which though).
But, then again. You just rely in spawning a subprocess.Popen call, and you have to build the command string yourself. No?
----- Original Message -----
From: scons-users at scons.org
To: scons-users at scons.org
At: Nov 22 2013 14:14:37
2013/11/21 William Deegan <bill at baddogconsulting.com>
On Nov 21, 2013, at 12:22 PM, Leandro Moreno <leandro.moreno at tallertechnologies.com> wrote:
> Hello again SCons guys!
>
> This time, I have an inconvenient trying to use the function Execute() from SCons.
> I have a builder to check the name's convention. But the tool that do the job, check the dependencies errors too. And I want to filter those errors. So, to do this I use subprocess.Popen(), and I take the stderr.
> Now, I want to use The Execute(), but the problem here is that I don't know how to take the output to manipulate It. Is there a way to do this?
Redirect the output to a file, add the file to the list of outputs in the builder's emitter.
Create another builder to process that file.
That's really inconvenient.
Couldn't we subclass Execute an make it return a stderr or stdout object?
Is there interest in something along this lines?
-Bill
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users
--
Matías Iturburu
Software Engineer
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: matias.iturburu
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users
--
Matías Iturburu
Software Engineer
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: matias.iturburu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131122/89612c03/attachment.htm
More information about the Scons-users
mailing list