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
#3259 was recently fixed so the integrated console doesn't change CWD when using "Run/Debug Tests". However there are still commands and config that enforces and promotes unnecessary CWD-changes.
PowerShell: Run command (and it's Play-button in editor title bar) is hardcoded to change cwd to file's directory cwd: "${file}"
The first command should not change working directory in my opinion. The suggested launch config should also leave it unchanged (set to cwd: ""). People can change it if they want/need it.
This change would also encourage users to rely on $PSScriptRoot when referencing files relative to the script. I believe that's a good practice since working directory is rarely specified when running scripts in my experience.
PowerShell Version
Name Value---- -----PSVersion 7.2.5PSEdition CoreGitCommitId 7.2.5OS Microsoft Windows 10.0.22000Platform Win32NTPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}PSRemotingProtocolVersion 2.3SerializationVersion 1.1.0.1WSManStackVersion 3.0
fflaten
changed the title
Inconsistent behavior for changing working directory
Inconsistent behavior for working directory when running scripts
Jul 17, 2022
Prerequisites
Summary
#3259 was recently fixed so the integrated console doesn't change CWD when using "Run/Debug Tests". However there are still commands and config that enforces and promotes unnecessary CWD-changes.
PowerShell: Run
command (and it's Play-button in editor title bar) is hardcoded to change cwd to file's directorycwd: "${file}"
The suggested launch configuration also use
cwd: "${file}"
. However, debugging without launch config doesn't change cwd unless running in temporary console.The first command should not change working directory in my opinion. The suggested launch config should also leave it unchanged (set to
cwd: ""
). People can change it if they want/need it.This change would also encourage users to rely on
$PSScriptRoot
when referencing files relative to the script. I believe that's a good practice since working directory is rarely specified when running scripts in my experience.PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
Scenario 1:
PowerShell: Run
commandScenario 2:
Launch current file
The cwd/pwd in integrated console will be changed.
Visuals
No response
Logs
No response
The text was updated successfully, but these errors were encountered: