-
-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set-Location $null run slowly and High CPU usage #2076
Comments
Can reproduce, kinda... The problem isn't the code, it's the fact that you're invoking your test-file using a relative path and call this code. Let's say that code is in a file called I've seen this before, but wasn't sure if it was considered an issue or user-error, so never reported it myself. Can't remember seing a dedicated issue for it. Some ideas to solve it though:
|
I actually run it with an absolute path, not a relative path In VSCode, press F5 to run this test file, there will be no After your reminder, I switched to |
@fflaten |
This issue was resolved in VSCode by changing the key binding settings, but other users may still experience the issue by default. It is recommended to fix it anyway. |
Will look into the interactive execution logic when I get home. Running scripts directly calls What changes to the keybinding did you do btw? Disable F5 to run script files completely? |
Found the culprit for this scenario. I didn't completely remove a variable name in a previous PR which caused interactive execution (running files directly) to basically run @nohwnd I didn't tag the PR as a fix for this issue as we might want to consider a more generic improvement, see my initial comment. |
Yeah, we would probably capture the original path and CD back to it at the end, good idea. |
@fflaten The default command is When both key bindings match, the key binding near the end of the JSON file has higher priority, so you just need to set the same hotkey and place it after the two items above. Specifically, these two items ↓ {
"key": "ctrl+f5",
"command": "PowerShell.RunPesterTestsFromFile",
"when": "resourceFilename =~ /.*Tests\\.ps1/"
},
{
"key": "f5",
"command": "PowerShell.DebugPesterTestsFromFile",
"when": "resourceFilename =~ /.*Tests\\.ps1/"
} |
Describe 'root' {it 'test' {Set-Location $null}}
Run this script and wait for the execution to complete. Running this script again should also return the test results immediately, but the actual situation is that PowerShell will not be able to interact, and the CPU utilization begins to rise abnormally. Wait a few minutes before you can receive the return value, and may be accompanied by an error message.The same conclusion can be reached by testing in new virtual machines.
The text was updated successfully, but these errors were encountered: