Skip to content
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

Debugging javascript with Oh My Posh in WSL2 produces a weird debugger state and no output #1642

Closed
bnm12 opened this issue Feb 23, 2023 · 9 comments · Fixed by #1702
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@bnm12
Copy link

bnm12 commented Feb 23, 2023

Type: Bug

Using WSL 2 (Ubuntu 22.04.2)
When I have the Oh My Posh theme in my .bashrc file and lunch a debug task that starts a npm task in the javascript debugging terminal it seems like the task executes before Oh My Posh does and gets cut off. The debugger starts, but no output prints to the terminal.
Also no breakpoints get hit and the vs-code debug call stack doesn't populate.
Re-running the command that prints to the terminal manually after it's initalized (same terminal window) works as expected

Initial state
image

Re-running command manually
image

My launch configuration is:

{
  "name": "Test: TSNode Current File",
  "type": "node-terminal",
  "request": "launch",
  "command": "npm run mocha:local:glob ${relativeFile}",
  "env": {
    "LOGLEVEL": "debug"
  }
}

VS Code version: Code 1.75.1 (441438abd1ac652551dbe4d408dfcec8a499b8bf, 2023-02-08T21:32:34.589Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Sandboxed: Yes
Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13700K (24 x 3418)
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: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 63.75GB (34.93GB free)
Process Argv --file-uri vscode-remote://wsl%2Bubuntu-22.04/home//api/api.code-workspace --crash-reporter-id ae095441-8f6f-4bd0-b81e-e8e6ca5105a5
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-22.04
OS Linux x64 5.10.16.3-microsoft-standard-WSL2
CPUs 13th Gen Intel(R) Core(TM) i7-13700K (24 x 3417)
Memory (System) 54.93GB (51.15GB free)
VM 0%
Extensions (44)
Extension Author (truncated) Version
better-comments aar 3.0.2
Bookmarks ale 13.3.1
postcss css 1.0.9
better-cpp-syntax jef 1.17.2
jupyter-keymap ms- 1.0.0
remote-containers ms- 0.275.1
remote-ssh ms- 0.96.0
remote-ssh-edit ms- 0.84.0
remote-wsl ms- 0.75.3
vscode-remote-extensionpack ms- 0.24.0
remote-explorer ms- 0.2.0
remote-server ms- 1.0.0
vscode-serial-monitor ms- 0.8.0
aws-toolkit-vscode ama 1.63.0
vscode-tailwindcss bra 0.9.7
doxdocgen csc 1.4.0
vscode-eslint dba 2.4.0
gitlens eam 13.2.0
EditorConfig Edi 0.16.4
prettier-vscode esb 9.10.4
vscode-pull-request-github Git 0.58.2
vscode-mocha-test-adapter hbe 2.14.1
vscode-test-explorer hbe 2.21.1
cmake-language-support-vscode jos 0.0.9
vscode-docker ms- 1.23.3
vscode-dotnet-runtime ms- 1.6.0
isort ms- 2022.8.0
python ms- 2023.2.0
vscode-pylance ms- 2023.2.40
jupyter ms- 2023.1.2010391206
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.14
vscode-jupyter-cell-tags ms- 0.1.6
vscode-jupyter-slideshow ms- 0.1.5
cmake-tools ms- 1.13.45
cpptools ms- 1.14.3
cpptools-extension-pack ms- 1.3.0
test-adapter-converter ms- 0.1.6
vscode-serial-monitor ms- 0.8.0
typescript-mono-repo-import-helper q 0.0.6
command-variable rio 1.49.1
code-spell-checker str 2.17.1
linear str 0.0.3
cmake twx 0.0.17

(3 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30669237
azure-dev_surveyone:30548225
pyindex848:30662994
nodejswelcome1cf:30587006
282f8724:30602487
pyind779:30662992
89544117:30613380
pythonsymbol12cf:30657549
vsctsb:30662444
pythonb192cf:30669361

@bnm12 bnm12 changed the title Debugging javascript with Oh My Posh produces a weird debugger state and no output Debugging javascript with Oh My Posh in WSL2 produces a weird debugger state and no output Mar 23, 2023
@roblourens
Copy link
Member

Is there anything we can do here @Tyriar @meganrogge?

@meganrogge
Copy link

a lot going on here

launch a debug task that starts an npm task in the javascript debugging terminal

I think @connor4312 might know more

@connor4312
Copy link
Member

That's fine and valid. The issue here seems solely that the text is injected before the shell(?) is ready and the ignored. Not sure whether that's entirely on us or not.

Here's the code where the terminal is started and program is written

const terminal = await this.createTerminal({
name: runData.params.name,
cwd: runData.params.cwd,
iconPath: new vscode.ThemeIcon('debug'),
env: hideDebugInfoFromConsole(binary, env).defined(),
isTransient: true,
});
this.terminalCreatedEmitter.fire(terminal);
terminal.show();
const program = (this.program = new VSCodeTerminalProcess(terminal));
if (runData.params.command) {
terminal.sendText(runData.params.command, true);
}

@meganrogge do you think we should await the terminal.processId to avoid this, or any other recommendation?

@bnm12
Copy link
Author

bnm12 commented Apr 5, 2023

Would this mean that any sufficiently large/slow .bashrc file would cause this behavior? If so that should be pretty easy to set up a repro for using a wait of some kind shouldn't it?

@meganrogge
Copy link

@connor4312
Copy link
Member

connor4312 commented Apr 5, 2023

Ah, I see, thanks. It's quite unfortunate that we have that one second pause if we need to giveShellTimeToInitialize. Makes the experience slower than perhaps necessary. Is there any stronger signal we can use to avoid that artificial delay?

@meganrogge
Copy link

Oh, I don't think you'll need to do that. I would think just the await terminal.processId would be sufficient

@connor4312 connor4312 transferred this issue from microsoft/vscode Apr 5, 2023
@connor4312 connor4312 assigned connor4312 and unassigned roblourens Apr 5, 2023
@connor4312 connor4312 added the bug Issue identified by VS Code Team member as probable bug label Apr 5, 2023
@connor4312 connor4312 added this to the April 2023 milestone Apr 5, 2023
@connor4312 connor4312 modified the milestones: April 2023, May 2023 Apr 25, 2023
@sammys
Copy link

sammys commented May 9, 2023

My particular ~/.zshrc loads oh-my-zsh with the nvm plugin. I noticed that the extension sets NVM_BIN so I have used this as a workaround in ~/.nvmrc while the issue is sorted out by @meganrogge and @connor4312 :

[ -z "$NVM_BIN" ] && plugins+=(zsh-nvm)

connor4312 added a commit that referenced this issue May 10, 2023
* fix: terminal launches sometimes sending commands too soon

Fixes #1642

* address pr comments
@meganrogge meganrogge added the verified Verification succeeded label Jun 1, 2023
@meganrogge
Copy link

Verified with a code review, but @bnm12 pls let us know if this now works for you without the workaround you mentioned above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants