Open adamfortuno opened 6 years ago
for function f
variable $script:foo
- like a global variable.
RSJob can not import any variables that used inside functions if it not local.
Btw, it is a bad practice.
as a workaround you can use truly global
variables, function parameters
or modules
(variable defined in a module will be imported with module
On a machine in a distant land, exists a script named
thing.ps1
with content:If I attempt to run
f
from my interactive session, I see "abc" like I'd expect:If I try to run it via
Start-RSJob
, I see nothing...The value
$script:foo
in the script passed toStart-RSJob
returns as $null.Can you not use variables in the script scope?