microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Unable to launch debugger with fish shell as default system shell. #239

Open anthonyjclark opened 8 years ago

anthonyjclark commented 8 years ago

I am working on OS X (10.10.5). I prefer to have my login shell set to fish (/usr/local/bin/fish). However, this appears to break the method currently being used by the extension to launch external console commands.

Specifically, the terminal window that pops up (not a big deal, but it would be "nice" if the extension used the internal debugger settings--I prefer iTerm.app to terminal.app) is pretty obviously expecting a bash shell. My default shell (fish) fails pretty miserably with the given commands, and VS Code quite nicely gives the following message:

Unable to start debugging. Failed to initialize debugger terminal.

Basically I am asking this: is there a method for forcing the external command to use a bash environment instead of the default system environment?

I'd prefer to not have to switch back and forth just to run the debugger (which works fantastically when I switch the system login shell to bash).

jacdavis commented 8 years ago

Thanks for reporting this. On mac, the actual launching of the terminal is a feature of lldb. I don't recall seeing anything in that code-path which would allow for this customization. However, we hope to move to the new internal terminal that was added to vscode in the near future.

There is, however, a shell script that is executed as we bring up the debug adapter (see ~/.vscode/extensions/ms-vscode.cpptools-0.9.1\OpenDebugAD7.) I was originally wondering if you could switch the shell for the debug adapter (and therefore the debuggee) by starting bash from that script, however, I realized the she-bang at the top already runs this as bash. lldb must not be starting the console for the debuggee in the same shell that lldb is running in.

We'll probably need to make a fix for this happen.

anthonyjclark commented 8 years ago

Thanks for the quick reply! FYI, when I switch the debugger from lldb to gdb (setting MIMode) it appears to have the same issue. You probably assumed this, but I thought the extra information may be of use.

jacdavis commented 8 years ago

Alright, thanks for the extra info. Strangely, we actually launch the debuggee via bash. I suspect the option to override the shell is getting applied after the intial bash launch.

pluskid commented 7 years ago

Run into the same problem here:

⟩ arch -arch x86_64 '/Users/xxx/.vscode/extensions/ms-vscode.cpptools-0.11.4/debugAdapters/lldb/bin/lldb-launcher' --unix-socket=/tmp/DxmdOu --arch=x86_64 --working-dir '/Users/xxx/work/xxx' --disable-aslr --  '/Users/xxx/anaconda2/bin/python' 'example/xxx.py' ; echo Process exited with status $? ; exit
$? is not the exit status. In fish, please use $status.
fish: arch -arch x86_64 '/Users/xxx/.vscode/extensions/ms-vscode.cpptools-0.11.4/debugAdapters/lldb/bin/lldb-launcher' --unix-socket=/tmp/DxmdOu --arch=x86_64 --working-dir '/Users/xxx/work/xxx' --disable-aslr --  '/Users/xxx/anaconda2/bin/python' 'example/xxx.py' ; echo Process exited with status $? ; exit

The outputs above are shown in a popup macos terminal, and it was attempted to be run in fish shell.

loganintech commented 6 years ago

@pluskid From my findings, that's the shell command that actually runs when testing something. If you change $? to $status and hit enter, it will actually debug and output properly. There has to be a place where this can be configured, right?

ianchen-tw commented 6 years ago

same problem here

tskardal commented 6 years ago

+1

KazNX commented 6 years ago

+1 As a workaround, I've been setting "externalConsole": false, but this is an unsatisfactory fix.

gibsjose commented 5 years ago

Any progress on this? I have also found setting "externalConsole": false to be the only workaround in the short term.

FuelledByCoffee commented 5 years ago

Is this ever gonna be fixed?

thecodewarrior commented 5 years ago

If you're on a mac and use another app as your default terminal you can just change the shell that Terminal.app uses: image

ipg0 commented 2 years ago

Is this issue not ever going to be fixed?