[erlang-questions] Running multiple commands like os:cmd/1

Siraaj Khandkar siraaj@REDACTED
Thu Dec 27 13:41:50 CET 2012


On Dec 27, 2012, at 6:08 AM, Gleb Peregud <gleber.p@REDACTED> wrote:

> On Thu, Dec 27, 2012 at 1:25 AM, Siraaj Khandkar <siraaj@REDACTED> wrote:
>> Why does it have to be a single shell? What is wrong with multiple ports?
> 
> It's because I want to preserve changes in env variables between calls
> (see requirement 4), since I want to be able to run commands like ".
> /opt/erlang/r15b/activate" to prepare environment for further
> commands. Think of a sequence of commands run by CI server.

OK, this is getting hacky now, but how about a script that reads lines on stdin
and outputs them with a prefix, then execute your wrapped commands as
backgrounded subshells. Something like this:

((command_1; echo $?) | wrapper --prefix "$ID1 => ") &
((command_2; echo $?) | wrapper --prefix "$ID2 => ") &


-- 
Siraaj Khandkar
.o.
..o
ooo




More information about the erlang-questions mailing list