develooper Front page | perl.perl5.porters | Postings from March 2017

Re: [perl #128994] Environment variables are not always passed tochild process

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 30, 2017 10:29
Subject:
Re: [perl #128994] Environment variables are not always passed tochild process
Message ID:
20170330102909.GT3342@iabyn.com
On Fri, Aug 19, 2016 at 11:03:30AM -0700, Cherio wrote:
> Environment variables with '.' (dot character) are not always passed to the
> child process.
> In the following example 'test.variable' will ne be available to the child
> process when it starts:
> 
> $ENV{'test.variable'} = 'Hello kitty';
> system("'/bin/program' 'arg1' 'arg2'");
> 
> However a slightly modified version of the same code works and
> 'test.variable' is available in the child program
> 
> $ENV{'test.variable'} = 'Hello kitty';
> system('/bin/program', 'arg1', 'arg2');
> 
> This is a regression. It worked both ways in Perl 5.18

Any environment variable removal is been done by your shell, not perl.
In the first case above system() passes the argument (and env) to your
shell for processing.

Closing.

-- 
Justice is when you get what you deserve.
Law is when you get what you pay for.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About