2013/11/14 Tobias Leich via RT <[email protected]>

> Hi, shell() is supposed to spawn a shell as the name suggests (`sh` on
> linuxes, `cmd.exe` on windows).
> run() and qx// do *not* spawn a shell. So you must be a bit carefull when
> acessing enironment vars.
>

Yes, I'm aware of that, but I think in both case (spawn and non-spawn),
environment vars need to be passed into subprocesses.


> Examples:
> perl6-p -e '%*ENV<ENV_TEST>="foo"; run("sh", "-c", "echo \$ENV_TEST")'
> foo
>
> perl6-p -e '%*ENV<ENV_TEST>="foo"; run("env")'
> LIBOVERLAY_SCROLLBAR=0
> [...]
> ENV_TEST=foo
>

Curious that my results are different when running those two lines:

$ perl6 -e '%*ENV<ENV_TEST>="foo"; run("sh", "-c", "echo \$ENV_TEST")'

$ perl6 -e '%*ENV<ENV_TEST>="foo"; run("env")' | grep ENV_TEST
$

I tested them in bash and mksh under linux, not sure if it is relevant.


>
> This however seems to be a valid bug:
> perl6-p -e '%*ENV<ENV_TEST>="foo"; say qx/env/ ~~ /ENV_TEST/'
> Nil
>
>
>

Reply via email to