sdetweil has asked for the wisdom of the Perl Monks concerning the following question:
I have this multi-platform application. it launches children that run for a short period of time.
I need to communicate from parent to child.
so just before launching the child, I do
$ENV{'varname'}='value';
and in the child, I get the environment variable and all is well.
this works on Windows without problem, but the variable does not show up for the linux child. in both cases I am actually starting a command shell script. xxx.cmd on Windows and xxx.sh on linux. the set command dumps the environment, and on linux the variable is not set when xxx.sh is started.
I do not need the value to be persistent, and I understand the reasons and issues there.
one piece of info, the child is started with OPEN so that the parent can monitor the childs console output
I need to communicate from parent to child.
so just before launching the child, I do
$ENV{'varname'}='value';
and in the child, I get the environment variable and all is well.
this works on Windows without problem, but the variable does not show up for the linux child. in both cases I am actually starting a command shell script. xxx.cmd on Windows and xxx.sh on linux. the set command dumps the environment, and on linux the variable is not set when xxx.sh is started.
I do not need the value to be persistent, and I understand the reasons and issues there.
one piece of info, the child is started with OPEN so that the parent can monitor the childs console output
on perl 5.10, linux fedora 10, 32 bit (can't update for other reasons)if($environmentDetails->GetValue() eq "Yes"){ $ENV{'SKIP_SYSTEM'}='0'; } else{ $ENV{'SKIP_SYSTEM'}='1'; } # have to execute the shell script from the current folder.. # *ix is picky, you must be explicit open(CMD, ( ($^O eq 'MSWin32' ) ? "":"./")."$command 2>&1 |"); while(<CMD>){ $detailsInfo->AppendText($_); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: passing env{} variable to child fails on linux,works on windows
by RichardK (Parson) on Jan 12, 2013 at 16:11 UTC | |
Re: passing env{} variable to child fails on linux,works on windows
by flexvault (Monsignor) on Jan 12, 2013 at 16:48 UTC | |
by sdetweil (Sexton) on Jan 12, 2013 at 19:03 UTC | |
by dave_the_m (Monsignor) on Jan 12, 2013 at 19:37 UTC | |
by sdetweil (Sexton) on Jan 13, 2013 at 13:39 UTC | |
by andal (Hermit) on Jan 14, 2013 at 09:19 UTC | |
by thargas (Deacon) on Jan 14, 2013 at 13:49 UTC | |
by flexvault (Monsignor) on Jan 12, 2013 at 19:11 UTC |
Back to
Seekers of Perl Wisdom