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

Gleb Peregud <>
Thu Dec 27 14:03:15 CET 2012


This solution won't work due to the fact that env variables changes in
subshells are not propagated to main shell.

At the moment solution 99.99% solution in the previous email works for
me. I have a feeling that a proper solution would have to reimplement
large part of the /bin/sh to make it really robust.

On Thu, Dec 27, 2012 at 1:41 PM, Siraaj Khandkar <> wrote:
> On Dec 27, 2012, at 6:08 AM, Gleb Peregud <> wrote:
>
>> On Thu, Dec 27, 2012 at 1:25 AM, Siraaj Khandkar <> 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