microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.26k stars 29.3k forks source link

MacOS: "no job control in this shell" prevents Ctrl+C #184713

Open bitcrush-robin opened 1 year ago

bitcrush-robin commented 1 year ago

Type: Bug

Every terminal starts with the following message before the first prompt:

bash: cannot set terminal process group (8590): Inappropriate ioctl for device
bash: no job control in this shell

I thought it was related to issue #181939 but it's still present.

It prevents ctrl+C out of long-running processes, and other similar commands. If a process is running when the window is closed, CodeHelper crashes.

VS Code version: Code 1.79.0 (Universal) (b380da4ef1ee00e224a15c1d4d9793e27c2b6302, 2023-06-07T14:29:00.206Z) OS version: Darwin x64 17.7.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 x 4201)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 3, 3| |Memory (System)|64.00GB (29.86GB free)| |Process Argv|-psn_0_725169| |Screen Reader|no| |VM|0%|
Extensions (28) Extension|Author (truncated)|Version ---|---|--- laravel-extra-intellisense|ami|0.6.3 vscode-intelephense-client|bme|1.9.5 vscode-tailwindcss|bra|0.9.11 multi-cursor-case-preserve|Car|1.0.5 postcss|css|1.0.9 vscode-eslint|dba|2.4.0 es7-react-js-snippets|dsz|4.4.3 permute-lines|ear|1.1.0 json-tools|eri|1.0.2 prettier-vscode|esb|9.13.0 vscode-smart-column-indenter|lmc|0.0.13 dotenv|mik|1.0.1 isort|ms-|2022.8.0 python|ms-|2023.10.0 vscode-pylance|ms-|2023.6.10 jupyter|ms-|2023.5.1001582324 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 php-docblocker|nei|2.7.0 laravel-blade|one|1.34.0 vscode-sort-json|ric|1.20.0 theme-check-vscode|Sho|1.10.0 vscode-scss-formatter|sib|2.5.0 php-refactor-tool|st-|0.4.4 auto-correct|syg|0.2.2 volar|Vue|1.6.4 gitblame|wad|10.2.0 change-case|wma|1.0.0 (1 theme extensions excluded)
ankarastrix commented 1 year ago

same issue ONLY on macos

klipsedeville commented 1 year ago

Having same issue. Updated from 1.78.x to 1.79.0 and still hasn't fixed issue on Mac High Sierra

ankarastrix commented 1 year ago

downgraded Visual Studio Code to version 1.77.3, and now it's working fine

meganrogge commented 1 year ago

does this happen in an external terminal?

fonzcastellanos commented 1 year ago

I'm having this issue on macOS Mojave v10.14.16 using Visual Studio Code v1.79.1. Issue has been around for a bit more than a month, so it's persisted for several versions.

@meganrogge I do not have this issue on external terminal, which is what I've been using exclusively since this issue arose.

deepak1556 commented 1 year ago

Looks like issue is localized to users on macOS High Sierra.

cirex-web commented 1 year ago

I'm having a similar issue on Mojave

davzuniga commented 1 year ago

I am having the same issue in Mojave, it started after an update, and now if I try to manually kill the terminal, vscode crashes completely.

bitcrush-robin commented 1 year ago

@meganrogge

does this happen in an external terminal?

No, only within Code's terminals.

The suggested fix in #184837 of disabling terminal.integrated.shellIntegration.enabled doesn't fix the issue either.

starball5 commented 1 year ago

Related on Stack Overflow:

If you are able, help closing the duplicates would be appreciated, so everyone can find the answer in one place.

Codelica commented 1 year ago

This is a frustrating bug for sure. For now I'm running everything under tmux in the terminal, where ctrl-c does get honored.

Using 1.79.2 on Mojave w/ BASH.

innerexception commented 1 year ago

Still broken on Mojave with the latest VSCode as of today: June 2023 (version 1.80)

MrBlueBird commented 1 year ago

For me, the problem was caused by the carabiner elements application. MacOS Mojave 10.14 Vscode 1.79.0

manulera commented 1 year ago

No workaround until it gets fixed?

starball5 commented 1 year ago

@manulera https://stackoverflow.com/a/76570268/11107541

jmldavis commented 1 year ago

Still not working as of VS Code v1.80.1

Tyriar commented 1 year ago

@deepak1556 this seems to be affecting a lot of users

bitcrush-robin commented 1 year ago

I renamed to try to help people find it by searching.

mouday commented 1 year ago

me too!

my version.

Version: 1.80.2
Commit: 2ccd690cbff1569e4a83d7c43d45101f817401dc
Date: 2023-07-27T21:05:41.366Z (1 wk ago)
Electron: 22.3.14
ElectronBuildId: 22695494
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin x64 18.5.0
bash: no job control in this shell

and ctrl + c not work.

deepak1556 commented 1 year ago

@Tyriar I need to setup the affected version atleast Mojave to debug this further, unfortunately parallels does not allow going back more than 3 version and I am currently on Sonoma. I am now setting up https://github.com/sickcodes/Docker-OSX to move this issue forward. Very likely use of a missing posix_spawn api in these affected versions since there are no users reporting from >= Big Sur

Tyriar commented 1 year ago

Oh, this is only affecting versions of macOS that aren't even maintained by Apple anymore? https://en.wikipedia.org/wiki/MacOS_version_history#Releases

They don't seem to support them for very long, do you know if very old hardware typically has the option to update?

That-Guy977 commented 1 year ago

@Tyriar I'm using Mojave on a mid-2012 model and it does have the option to update to Catalina, although I'm not sure past that

molul commented 1 year ago

Having the exact same issue. MacMini 2012 with Mojave, haven't been able to stop terminal with Ctrl+C for months, and if I kill terminal with the trash icon, VS Code crashes.

manulera commented 1 year ago

My 2 cents on this, I use poetry as a reference manager with python, and when I use the local python virtual environment with poetry shell, Ctrl + C works. It does not work with my anaconda installation, though.

nouo commented 1 year ago

You can prevent VS Code from crashing. Add this line to your .bash_profile:

export PROMPT_COMMAND="set -m"

Note: This does not fix the CTRL+C command!

My version of VS Code:

Version: 1.81.1 (Universal)
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:20:33.924Z (2 days ago)
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin x64 17.7.0
molul commented 1 year ago

@nouo It works, thanks. This is really helpful :)

starball5 commented 1 year ago

@nouo, @molul Out of curiosity, do you really need the PROMPT_COMMAND part? Can you not just put set -m in your Bash startup files?

bitcrush-robin commented 1 year ago

gregvanl pushed a commit to microsoft/vscode-docs that referenced this issue 3 days ago @Tyriar Clarify macOS support policy

@deepak1556 deepak1556 removed the important label yesterday

😬 This is staying in the milestone, right..?

patil-rahuls commented 1 year ago

@nouo It works. Much better(and the only saviour) than waiting months for this bug fix by VS Code team! Thanks a lot!!

Tyriar commented 1 year ago

@bitcrush-robin depending on @deepak1556's availability. The change to the macOS support policy it to clarify we aren't supporting fully macOS versions that Apple themselves don't. That doesn't mean we won't fix it, it's just not as high priority anymore. If you can upgrade your OS you should do that as it's not even receiving security updates 😱.

FuugoClay commented 1 year ago

This problem still occurs with vscode v1.81.1 as of this timestamp [sept 7, 2023]

Version: 1.81.1 Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794 Date: 2023-08-09T22:20:33.924Z (4 wks ago) Electron: 22.3.18 ElectronBuildId: 22689846 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Darwin x64 18.7.0 [osx 10.14.6 / Mojave]

mstv commented 1 year ago

183419 and a few more related tickets may have been fixed in insider's.

Though it has not yet made it to the current stable release again. So when may we actually expect it?

Version: 1.82.1 (system setup) Commit: 6509174151d557a81c9d0b5f8a5a1e9274db5585 Date: 2023-09-08T08:45:05.575Z Electron: 25.8.0 ElectronBuildId: 23503258 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045

Edit: The workaround export PROMPT_COMMAND="set -m" does not avoid the dead terminal for me.

huanghe2015 commented 1 year ago

Would you mind building a particular version with the frozen update?

dmagliano commented 1 year ago

Thanks @nouo , your tip saved me. The quickest turnaround.

You can prevent VS Code from crashing. Add this line to your .bash_profile: export PROMPT_COMMAND="set -m"

Had to switch to an older macbook (running High Sierra) and Ctrl+C is not working.

uzomao commented 1 year ago

@nouo 's workaround worked for me (thank you). combined with re-setting ctrl + c as a shortcut in the keyboard shortcuts menu

starball5 commented 1 year ago

@uzomao what exactly do you mean by "re-setting ctrl + c as a shortcut in the keyboard shortcuts menu"? What exact steps did you take to do that?

bitcrush-robin commented 1 year ago

VS Code desktop version starting with 1.83 (September 2023) is deprecating macOS Mojave (version 10.14 and older). Starting with VS Code 1.86 (January 2024) we will stop updating VS Code on macOS Mojave (version 10.14 and older).source

Still getting the error in 1.83. @deepak1556 @Tyriar Is there still a chance this will be fixed?

If not, we all might as well revert version back to 1.77

sbingner commented 1 year ago

They changed it to no longer allocate a pty for the shell, and the handling is apparently garbage. If you're not going to support it properly, just make the remote-ssh extension open source and somebody can fix it for you.

old (working)

Sams-Mac:setuptools sam$ ps 
  PID TTY           TIME CMD
  260 ttys000    0:00.16 -bash
 1645 ttys006    0:00.03 /bin/bash --login
Sams-Mac:setuptools sam$ ps axww | grep s000
  257   ??  S      0:00.02 sshd: sam@ttys000 
  260 s000  Ss+    0:00.16 -bash
 1895 s006  U+     0:00.00 grep s000
Sams-Mac:setuptools sam$ ps axww | grep s006
 1645 s006  Ss     0:00.03 /bin/bash --login
 1903 s006  R+     0:00.00 ps axww
 1904 s006  R+     0:00.00 grep s006

new

Sams-Mac:setuptools sam$ ps
  PID TTY           TIME CMD
  260 ttys000    0:00.16 -bash
Sams-Mac:setuptools sam$ ps axww | grep s000
  257   ??  S      0:00.02 sshd: sam@ttys000 
 2181   ??  R      0:00.00 grep s000
  260 s000  Ss+    0:00.16 -bash
0PandaDEV commented 1 year ago

same issue for me M1 Pro with macOS Sonoma 14

deepak1556 commented 1 year ago

I won't be able to get to this issue anytime soon, if anyone is interested to address this issue the relevant code is at https://github.com/microsoft/node-pty/blob/main/src/unix/pty.cc , the following tests would fail on the affected OS https://github.com/microsoft/node-pty/blob/d6ce76a801f68730f7204b7b27bb21dbf8e63001/src/unixTerminal.test.ts#L123 so you can use that as a starting point.

pummarolaalragu commented 11 months ago

same issue for me M1 Pro with macOS Sonoma 14

have you all found a solution?

0PandaDEV commented 11 months ago

honestly i don't know what the issues was here but i managed to fix the Ctrl+C not ending the terminal task on MacOS for me it was because it set the modifier key of control to another key thats why my ctrl+c got registered as alt+c and therefore did bot quit the terminal task

manulera commented 10 months ago

This happens again to me in MacOS Mojave with VSCode 1.85.1, and was not happenning with previous version

dcowan-london commented 9 months ago

Same issue on Fedora 38 and 39. VSCode installed as Flatpak from Flathub. Same in both Bash and ZSH (though ZSH doesn't show the no job control in this shell error).

Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.6.11-100.fc38.x86_64
That-Guy977 commented 9 months ago

RIP VSCode on Mojave. Set update.mode to "none" to disable auto-updates.

jtallen commented 9 months ago

Tried every other solution I could find relating to this (including rebinding ctrl+c), the only thing that worked was going back to 1.77. I think they're done making updates for these old versions of Mac so 1.77 will be the last working version without this issue.

Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:19:37.325Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin x64 17.7.0
Sandboxed: No

This is on High Sierra 10.13.6.

superbogy commented 6 months ago

same issue +1

tony-li-avepoint commented 6 months ago

same issue +1 Version: 1.89.1 (user setup) Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:13:33.891Z

sbingner commented 6 months ago

I won't be able to get to this issue anytime soon, if anyone is interested to address this issue the relevant code is at https://github.com/microsoft/node-pty/blob/main/src/unix/pty.cc , the following tests would fail on the affected OS https://github.com/microsoft/node-pty/blob/d6ce76a801f68730f7204b7b27bb21dbf8e63001/src/unixTerminal.test.ts#L123 so you can use that as a starting point.

I tried this but unfortunately running that test on the affected OSX system passes. The only thing that failed is:

1) UnixTerminal
       spawn
         should return the name of the sub process:
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/sam/source/node-pty/lib/unixTerminal.test.js)
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)

also on linux it fails with


  1) UnixTerminal
       signals in parent and child
         SIGINT - custom in parent and child:

      Uncaught AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

false !== true

But I never had this problem there afaik :|

paulgolter commented 4 months ago

I have the same issue on windows.

I am starting a vscode task that runs a python program.

Ctrl+c signal does not get forwarded to the programm / picked up.

Version: 1.90.1 (system setup) Commit: 611f9bfce64f25108829dd295f54a6894e87339d