Vscode-remote-release: Debugging with external terminal does not work

Created on 20 May 2019  路  12Comments  路  Source: microsoft/vscode-remote-release

Some debug extensions support to use an "external terminal" for running the target program (e.g. Python, Node, C++).

Using this option in a remote scenario (WSL, SSH, Docker Container) might result in the following error:

debug

Most helpful comment

I understand the externalConsole from true to false change needs to come from us. The common issue we see is in the Linux world where the user has a non-mainstream terminal application as their default but VS Code is set to a different value and in that instance to have a good way for the user to know where to change it to something they have. We have sticky'ed an issue in our repo to help users find and change that setting currently.

I'll make a change to default to use integrated console for new configurations.

All 12 comments

The issue is that some of the linux systems used in the remote scenarios don't have a terminal application "xterm".

The fix is to configure a different terminal emulator via the terminal.external.linuxExec setting (or to disable the use of an external terminal in the launch configuration).

Another issue is that the error reporting for this situation is not very helpful.

To address the bad error reporting I suggest to improve the error message in two places:

Instead of just returning the somewhat cryptic OS error received from VS Code:

2019-04-16_10-34-58

the affected extensions needs to return a better error message which embeds the OS error as further details.
For instance in Node Debug the same error shows up like this:

2019-04-16_10-19-54

In addition the error could contain a link that refers to more information about this problem and how to fix it.

In VS Code I will try to detect the "ENOENT" error and map it to a more meaning error message, e.g. "External terminal application 'xterm' not found".

In addition debug extensions might want to detect the case that they are running remotely and change the "external terminal" option into an "integrated terminal".
This is especially important for debug extensions that provide no user control and use a hardcoded "external terminal".

I've improved the error message that gets returned from VS Code to the debug extension. With this the error dialog for linux shows this:

2019-04-16_18-47-05

This was fixed for the April release.

@weinand Can you link the commit that fixed this? Thanks

Discussed with @chuxel. The concern is that message is not easy to understand for a windows user that tries SSH or DevContainer for an existing project.

The suggestion to provide some more guidance in the error dialog. Suggestion:
"Cannot launch debug target in terminal (can't find terminal application xterm). Open launch.json and change the console setting to use the internal console."

Yes, improving the message is one thing debug extensions need to do (VS Code provides only the "can't find terminal application xterm" part. The rest of the message comes from debug extensions that support an external terminal and only the extension knows the name of the launch config attribute).

Another way to avoid the problem completely is to use the Integrated Terminal as the default (instead of the External Terminal).

The rest of the message comes from debug extensions that support an external terminal and only the extension knows the name of the launch config attribute)

Is there a launch config attribute for users to change the terminal settings? I thought it was only in the VS Code Settings json that the setting existed. We ran into this with users using the RunInTerminal DAP message with external set but the default that VS Code chose doesn't exist on their machine. Once this is shipped, I can give it a shot and see if the experience is better.

I agree that if theres a way to point the user to the settings json option to configure it that would be useful too.

@pieandcakes terminal settings for configuring the Integrated and external terminals only exist in the VS Code settings. But a debug extension contributes the attribute that determines what terminal to use, e.g. externalConsole for C++ and console for Node.js. So the error message that explains what the user has to change must come from the extension too.

Here is the code from node-debug: https://github.com/microsoft/vscode-node-debug/blob/56dc3892885b3122385b785322b00a92d33fdded/src/node/nodeDebug.ts#L1115

The code that improves the runInTerminal error message from "spawn xterm ENOENT" to "can't find terminal application xterm" ships already since two VS Code releases.

I understand the externalConsole from true to false change needs to come from us. The common issue we see is in the Linux world where the user has a non-mainstream terminal application as their default but VS Code is set to a different value and in that instance to have a good way for the user to know where to change it to something they have. We have sticky'ed an issue in our repo to help users find and change that setting currently.

I'll make a change to default to use integrated console for new configurations.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gulshan picture gulshan  路  3Comments

kieferrm picture kieferrm  路  3Comments

grzegorz-silarski picture grzegorz-silarski  路  3Comments

sulume picture sulume  路  3Comments

gurdevrana picture gurdevrana  路  3Comments