in reply to Re: Get the process id, and output of a process, in a threaded environment
in thread Get the process id, and output of a process, in a threaded environment

The problem is that on non MSWin systems, external commands are invoked with main thread's ENV, not the local one (as documented in the linked page):
$ perl -Mthreads -e 'async { local %ENV = %ENV; $ENV{CPU} = "/"; open +my $PIPE, "echo \$CPU |"; print <$PIPE>}->join; $ENV{CPU}="MSWin"; sy +stem "echo \$CPU"' x86_64 MSWin
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^2: Get the process id, and output of a process, in a threaded environment
  • Download Code