-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productNeeds-InvestigationThe behavior reported in the issue is unexpected and needs further investigation.The behavior reported in the issue is unexpected and needs further investigation.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
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
On Windows
- Open an elevated pwsh session, and create 2 symbolic links as follows in a folder:
New-Item -ItemType SymbolicLink -Path pwsh-symlink -Value $pshome\pwsh.exe New-Item -ItemType SymbolicLink -Path pwsh-double-link -Value .\pwsh-symlink - Under the same folder, run
.\pwsh-symlink, and you will see pwsh console window pops up. - Under the same folder, run
.\pwsh-double-link, and you will see the "How do you want to open this file" window pops up.
Note:
Start-Processdoesn't use the final target of a symbolic link either.
However, it works fine on Unix
- Create 2 symbolic links as follows in a folder:
/bin/ln -s /opt/microsoft/powershell/7/pwsh pwsh-link /bin/ln -s /home/<user>/tmp/pwsh-link /home/<user>/tmp/pwsh-double - Under the same folder, run
./pwsh-link -c 1+1, and you will get2printed out as the result. - Under the same folder, run
./pwsh-double -c 1+1, and you will get2printed out as the result.
Expected behavior
On Windows:
1. pwsh should know that `pwsh-symlink` is actually a console application, and run into with the current console.
2. pwsh should be able to run `pwsh-double-link`, just like on Unix platforms.Actual behavior
On Windows
1. pwsh opens `pwsh-symlink` in a separate console window, which means it doesn't use the link target to check if it's a console application, and thus starts the process with 'UseShellExecute = true'.
2. pwsh cannot run `pwsh-double-link`, because when using `UseShellExecute`, the Shell automatically uses the immediate link target of a symbolic link file, but doesn't do recursive resolution when the immediate link target is again a symbolic link.Error details
No response
Environment data
The latest build from master, and happen on all 7.2.0-preview.9 as wellVisuals
iSazonov, suzuki-shunsuke and Renari
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productNeeds-InvestigationThe behavior reported in the issue is unexpected and needs further investigation.The behavior reported in the issue is unexpected and needs further investigation.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

