Boost logo

Boost-Build :

From: Steven Knight (knight_at_[hidden])
Date: 2005-09-21 13:37:18

Hi David--

>>>> Someone emailed me privately to say that we could pipe our commands
>>>> into cmd without ever creating a .bat file. That's an interesting
>>>> idea; I'm not sure how to implement it though.
>>> Really? I thought about that yesterday but the CMD.EXE docs don't
>>> mention anything like that. I guess it will take some experimentation to
>>> find out.
>> ECHO 'dir' | cmd
>> works for me.
> The helpful soul sent me this:
> I'm suggesting that if you have a slave CMD process and you have some set
> of commands then you want it to execute for you, then you:
> - use the UUID generator function to get an unique string
> - pipe the commands into the slave and capture their output
> - pipe echo abc12328fh8a (or whatever) as a signal
> - wait for the signal text to show up on the slave output
> Given that you don't see the child processes exit, you need to
> know when you've got all the output from the commands that you sent.

I've implemented something like this in Python, but it hasn't made it into
SCons proper yet. I'd be glad to share if it's helpful. There's also a
Perl module (IPC::Session) that does this, from which I stole some ideas.

In addition to your .bat file issues, there are two big advantages:

-- There are fewer quoting issues, since you're not relying on
something else's command-line interpretation. (Or at least
that's one thing I've noticed, YMMV.)

-- The mechanism works regardless of where the shell is being
executed, so you get good remote command execution largely
for little cost.

To be really robust, you want separate markers for the beginning and
end of both stdout and stderr, need to have the shell echo back the
command's exit status, and probably want a configurable timeout mechanism
of some sort.



Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at