-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
It is understood that the newly introduced, Unix-only Switch-Process cmdlet (alias exec) is not designed to have full feature parity with the exec built-in in POSIX-compatible shells, notably not with respect to supporting stream redirections.
However, making the replacement process inherit the caller's environment is an important part of exec functionality (and it is how it works in POSIX-compatible shells).
Related discussion predating Switch-Process:
# Run on macOS or Linux.
# Note the use of `exec`; if you remove it, 'bar' prints as expected
pwsh -nop -c '$env:FOO=''bar''; exec /bin/sh -c ''echo $FOO'''Expected behavior
barActual behavior
(no output)
Error details
No response
Environment data
PowerShell Core 7.3.0-rc.1 on Unix-like platformsVisuals
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.