You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using postpositional & (control operator) rather than Start-Job results in different current location (working directory) #4267
/
/home/jdoe # on Linux; on macOS: /User/jdoe; on Windows: C:\Users\jdoe\Documents
Environment data
PowerShell Core v6.0.0-beta.4 on macOS 10.12.5
PowerShell Core v6.0.0-beta.4 on Ubuntu 16.04.2 LTS
PowerShell Core v6.0.0-beta.4 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
This is by design. While & uses Start-Job under the covers, it is intended to mimic the *nix behavior which runs the background process in the current directory.
Speaking of mimicking *nix behavior: more things worth documenting:
From what I can tell, PowerShell's jobs are fundamentally different from Bash's (do tell if I'm missing something - I'm not too familiar with PS jobs):
They can only be run "batch"-style with no interactive user input supported (if you send a Bash script to the background with a PS job, for instance, and that script tries to read from (non-redirected) stdin, it will simply encounter EOF (nothing to read) and proceed with empty input. By contrast, Bash would "stop" (suspend) such a script, allowing it to be brought to the foreground via job control to then supply the input interactively.)
They never output directly to the invoking terminal.
Generally, PS has no equivalent to Bash's job control with respect to bringing jobs to the foreground / sending them to the background / "stopping" (suspending) and resuming them.
Activity
BrucePay commentedon Jul 18, 2017
This is by design. While & uses Start-Job under the covers, it is intended to mimic the *nix behavior which runs the background process in the current directory.
mklement0 commentedon Jul 18, 2017
Understood. Please make sure that the difference is documented.
mklement0 commentedon Aug 8, 2017
Speaking of mimicking *nix behavior: more things worth documenting:
From what I can tell, PowerShell's jobs are fundamentally different from Bash's (do tell if I'm missing something - I'm not too familiar with PS jobs):
They can only be run "batch"-style with no interactive user input supported (if you send a Bash script to the background with a PS job, for instance, and that script tries to read from (non-redirected) stdin, it will simply encounter EOF (nothing to read) and proceed with empty input. By contrast, Bash would "stop" (suspend) such a script, allowing it to be brought to the foreground via job control to then supply the input interactively.)
They never output directly to the invoking terminal.
Generally, PS has no equivalent to Bash's job control with respect to bringing jobs to the foreground / sending them to the background / "stopping" (suspending) and resuming them.