Powershell integrated terminal in VSCode doesn't start up.
System Details
- Operating system name and version: Ubuntu 16.04
- VS Code version: 1.25.0
- PowerShell extension version: 1.8.0
- Output from
$PSVersionTable: (see below)
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
As I can't start the integrated terminal, I ran these commands in normal powershell, ran via bash.
code -v
1.25.0
0f080e5267e829de46638128001aeb7ca2d6d50e
x64
$pseditor.EditorServicesVersion
<no output>
code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
$PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.2
PSEdition Core
GitCommitId v6.1.0-preview.2
OS Linux 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
I had a working Powershell integrated terminal and debugger just yesterday, using the old version of the Powershell extension.
VS code had a non clean exit (As my system locked up).
This morning I started Visual Studio Code and the integrated terminal doesn't work. Neither does the debugger. The Powershell extension also updated today.
After the terminal tries to launch it shows:
PowerShell Integrated Console Permissions to the pipe file were not set properly. Expected: 600 Actual: srw------- for file: /tmp/CoreFxPipe_PSES_5b0a428f-e0b7-4e90-b8c8-d0a44966a752
And after a while the terminal closes. Logs below:
the pwsh app seems to work fine in normal bash.
I tried to delete all the pipe like files with the following command:
rm /tmp/CoreFxPip* in the hope that it would re-create them correctly, but that didn't make a difference.
I tried to set the permissions correctly on the file it was complaining about (by running chmod 600 on the file it was complaining about) but that doesn't seem to work: it seems to re-create the files with incorrect permissions.
Running VSCode as root doesn't seem to help either (glad it is very loud about warning the user not to do this).
I did find this old issue but this seems to be more windows specific.
Attached Logs
2018-7-11 08:39:32 [NORMAL] - Syntax Folding Provider registered
2018-7-11 08:39:32 [NORMAL] - powershell.exe started, pid: 8751
2018-7-11 08:39:38 [NORMAL] - powershell.exe terminated or terminal UI was closed
2018-7-11 08:40:32 [NORMAL] - Language server startup failed.
2018-7-11 08:40:32 [ERROR] - The language service could not be started:
2018-7-11 08:40:32 [ERROR] - Timed out waiting for session file to appear.
Verbose logs attached. logs.zip
see https://github.com/PowerShell/vscode-powershell/issues/1421
./modules/PowerShellEditorServices/Start-EditorServices.ps1:227
replace
$mode = stat -c "%A" $PipeFile
to
$mode = stat -c "%a" $PipeFile
Awesome, thanks. Seems to have fixed it. I also replaced the other occurrence of %A with %a 2 lines down.
@Diederikjh Maybe only linux need fix.
Your probably right.
The debugger sometimes seems to crash on me. Not sure if it is related to the above changes.
Attached logs of crash (folder in zip file with name 1531297271-01474be5-727d-4a9f-99e3-32a83afee6f41531297269484 probably good place to start looking)
@Diederikjh, @fcharlie Can you please update your extension to 1.8.1 (just released then) and see if this issue is fixed?
Looks good for now. Terminal starts up, and debugging looks more stable. Thanks
I think this has regressed.
I'm getting
Permissions to the pipe file were not set properly. Expected: 600 Actual: for file: /tmp/CoreFxPipe_PSES_358c3f85-31c0-44b0-894c-802a7400bf55
When starting a PowerShell debugger.
Powershell Extension version is 1.8.4.
VS Code version is 1.27.2
@Diederikjh The last change was this one to use the full path of the stat binary (since this didn't work for users with custom stat installs).
Can you try changing the file back to just stat and reporting back?
Just tried that:
if ($IsLinux) {
$mode = stat -c "%a" $PipeFile
}
elseif ($IsMacOS) {
$mode = /usr/bin/stat -f "%A" $PipeFile
}
Same behavior unfortunately.
Hmmm, as far as I know that behaviour hasn’t been changed otherwise.
Have you upgraded PowerShell version?
There hasn't been any other changes to that area. Did you update your Mac recently?
If you do /usr/bin/stat -f "%A" somefile.txt
Do you get the expected value? Should be a 3 digit number.
I'm running on Ubuntu.
Yes I think a system update did do a Powershell update.
Running
/usr/bin/stat -c "%a" ./somefile.pdf
Returns
644
And what about just:
stat -c "%a" ./somefile.pdf
Since that's the actual code path you're going through. I expect it to be the same
Yep, the same.
Ive tried reproducing this issue in another system, and can't. Only difference I can see is the VSCode version where it does work is a bit older: 1.27.1
Both systems Ubuntu
Hmmm... Do you happen to remember how you opened vscode? With the code CLI or something else?
GUI on both systems.
<Win> -> code -> down arrow -> enter
I wonder if there's a bug in vscode where we don't have access to the path anymore...
If you open in via a terminal, does that change anything?
Starting from console (on both systems) has same behavior.
Can you paste the contents of ~/.vscode/extensions/ms-vscode.powershell-1.8.4/modules/PowerShellEditorServices/Start-EditorServices.ps1?
From system where it doesn't work: https://gist.github.com/Diederikjh/359977fdebd2b35d7a728978cfc97403 Modified as suggested above.
(On system where it does work: https://gist.github.com/Diederikjh/2ca3c158d679481c338581c59d125e77 should be unmodified.)