vscode: Terminal Shell Integration Error -- bash: eval: line 5: unexpected token `EOF' in conditional command
Type: Bug
With Terminal Shell Integration enabled opening a terminal results in the below error being reported in the shell window:
bash: eval: line 141: unexpected token `EOF' in conditional command
bash: eval: line 141: syntax error: unexpected end of file
A very similar error is reported everytime a command is executed (or the enter key is pressed):
bash: eval: line 5: unexpected token `EOF' in conditional command
bash: eval: line 5: syntax error: unexpected end of file
Enabling set -x
and hitting enter in the terminal shows this output:
+++ __vsc_preexec_all -x
+++ '[' 0 = 0 ']'
+++ __vsc_in_command_execution=1
+++ builtin eval '[['
bash: eval: line 5: unexpected token `EOF' in conditional command
bash: eval: line 5: syntax error: unexpected end of file
+++ __vsc_preexec
+++ __vsc_initialized=1
.... TRUNCATED ....
Looking at /usr/share/code/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh
reveals that the command (line 127) causing the error is:
__vsc_dbg_trap="$(trap -p DEBUG | cut -d' ' -f3 | tr -d \')"
which is called by the command (line 140):
builtin eval ${__vsc_dbg_trap}
Running echo ${__vsc_dbg_trap}
in the integrated terminal returns (minus the bash eval errors):
[[
When I execute the trap -p DEBUG
command (from line 127) in another bash shell (outside of VSCode) the result is:
trap -- '[[ "$BASH_COMMAND" != "$PROMPT_COMMAND" ]] && chruby_auto' DEBUG
and running the full trap -p DEBUG | cut -d' ' -f3 | tr -d \'
command (from line 127) returns:
[[
This did not occur prior to version 1.70.0 even with the Shell Integration setting enabled.
VS Code version: Code 1.70.0 (da76f93349a72022ca4670c1b84860304616aaa2, 2022-08-04T04:38:48.541Z) OS version: Linux x64 5.18.15-200.fc36.x86_64 Modes:
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-10850H CPU @ 2.70GHz (12 x 2700) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: disabled_software video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | 2, 1, 1 |
Memory (System) | 62.56GB (49.15GB free) |
Process Argv | –unity-launch --crash-reporter-id 57fdd0a5-4103-4bed-9134-70c1dcd69cc9 |
Screen Reader | no |
VM | 0% |
DESKTOP_SESSION | gnome-xorg |
XDG_CURRENT_DESKTOP | GNOME |
XDG_SESSION_DESKTOP | gnome-xorg |
XDG_SESSION_TYPE | x11 |
Extensions (38)
Extension | Author (truncated) | Version |
---|---|---|
asciidoctor-vscode | asc | 2.9.8 |
scratchpads | bue | 0.0.7 |
solargraph | cas | 0.23.0 |
vscode-markdownlint | Dav | 0.47.0 |
ansible-vault | dho | 0.1.3 |
docs-markdown | doc | 0.2.113 |
githistory | don | 0.6.19 |
gitlens | eam | 12.1.2 |
json-tools | eri | 1.0.2 |
opensslutils | ffa | 1.1.1 |
shell-format | fox | 7.2.2 |
gc-excelviewer | Gra | 4.2.55 |
todo-tree | Gru | 0.0.215 |
rest-client | hum | 0.25.0 |
vscode-jmespath | jos | 0.0.6 |
bash-ide-vscode | mad | 1.14.0 |
git-graph | mhu | 1.30.0 |
vscode-docker | ms- | 1.22.1 |
python | ms- | 2022.12.0 |
vscode-pylance | ms- | 2022.8.10 |
remote-containers | ms- | 0.241.3 |
remote-ssh | ms- | 0.84.0 |
remote-ssh-edit | ms- | 0.80.0 |
cpptools | ms- | 1.11.4 |
ruby | reb | 0.28.1 |
ansible | red | 0.11.12 |
vscode-commons | red | 0.0.6 |
vscode-yaml | red | 1.9.1 |
bash-debug | rog | 0.3.9 |
rufo-vscode | sil | 0.0.3 |
code-spell-checker | str | 2.3.4 |
shellcheck | tim | 0.19.6 |
tom | 1.2.0 | |
vscode-icons | vsc | 11.14.0 |
vim | vsc | 1.23.2 |
jinja | who | 0.0.8 |
vscode-ruby | win | 0.28.0 |
markdown-all-in-one | yzh | 3.4.3 |
(2 theme extensions excluded)
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vscaat:30438848
pylanb8912cf:30529770
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 20 (10 by maintainers)
Commits related to this issue
- fix #157189 — committed to microsoft/vscode by meganrogge 2 years ago
@jazzlw I think you are hitting what was reported in #157851 and fixed in #158124
That is the line that is trying to be run and it has the
'
around it so bash thinks it is a single string and doesn’t parse it. Which results in the error:That trap command is coming from
chruby
which is used for managing different Ruby versions. The code adding it can be found at https://github.com/postmodern/chruby/blob/613a4834049e4d8de52de764213182a59c214ce1/share/chruby/auto.sh#L32.@Tyriar Here you go.
Also, in case it helps, I’m running Fedora 36 Workstation.
I had this same issue, and just updated. The original issue is gone, but now I get another bash error:
bash: [[ "$BASH_COMMAND" != "$PROMPT_COMMAND" ]] && chruby_auto: command not found
Using
set -x
to see what’s running yields:@meganrogge should I make a new issue for this?