Subprocess return code is incorrectly returned
@eleanorjboyd arbeitet bereits daran.
Seit 30.6.2025.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Type: Bug
Behaviour
It appears that if a python subprocess is called from a debugged process and fails, the return code of the subprocess is not correctly passed on to the caller.
Steps to reproduce:
Example code experiment.py:
import subprocess
import sys
proc = subprocess.run(
[sys.executable, "-mfred"],
check=False,
)
print(f"returncode: {proc.returncode}")
If run on the command line, this produces
$ /opt/bb/bin/python3.12 ~/experiment.py
/opt/bb/bin/python3.12: No module named fred
returncode: 1
If run via a launch config such as
{
"name": "Python Debugger: Experiment",
"type": "debugpy",
"request": "launch",
"program": "/home/ralexander72/experiment.py",
"console": "integratedTerminal"
}
The output is
$ cd /home/ralexander72/test ; /usr/bin/env /opt/bb/bin/python3.12 /bb/data/ralexander72/vscode-server/extensions/ms-python.debugpy-2025.8.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 60207 -- /home/ralexander72/experiment.py
No module named fred
returncode: 0
Similarly, running with check=True produces an exception in the non-debugged case but apparent success when run via the debugger.
Adding "subProcess": false to the launch config produces the expected output, so presumably the problem is that the debugger is intercepting and debugging the subprocess (which is normally nice behaviour), but failing to pass on the correct return code after termination of the subprocess.
This is highly unexpected behaviour - could you please investigate?
Extension version: 2025.8.0
VS Code version: Code 1.101.1 (18e3a1ec544e6907be1e944a94c496e302073435, 2025-06-18T13:35:12.605Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Connection to 'ssh-remote+mydev' could not be established
Remote OS version: Linux x64 4.18.0-553.50.1.el8_10.x86_64
Remote OS version: Linux x64 4.18.0-553.50.1.el8_10.x86_64
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.11
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz (36 x 3000) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on 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_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 127.80GB (95.16GB free) |
| Process Argv | --folder-uri vscode-remote://ssh-remote%2Bmydev/bb/mbige/mbig_u28868517/ws/nextstep |
| Screen Reader | no |
| VM | 0% |
Connection to 'ssh-remote+mydev' could not be established
| Item | Value |
|---|---|
| Remote | SSH: mydev |
| OS | Linux x64 4.18.0-553.50.1.el8_10.x86_64 |
| CPUs | Intel Xeon Processor (Cascadelake) (16 x 0) |
| Memory (System) | 93.89GB (78.18GB free) |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | SSH: mydev |
| OS | Linux x64 4.18.0-553.50.1.el8_10.x86_64 |
| CPUs | Intel Xeon Processor (Cascadelake) (16 x 0) |
| Memory (System) | 93.89GB (78.18GB free) |
| VM | 0% |
- Vorherrschende Sprache
- TypeScript
- Sterne
- 181
- Forks
- 126
- Ø Merge
- 8 Std. 49 Min.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/vscode-python-debugger
-
triage-needed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
microsoft/vscode-python-debugger#1110 ·
-
triage-needed
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
microsoft/vscode-python-debugger#1024 · 1 Kommentar ·
-
triage-needed
microsoft/vscode-python-debugger#1111 · 1 Reaktion · 1 zugewiesene Person ·
-
triage-needed
microsoft/vscode-python-debugger#1104 · 1 Reaktion · 1 zugewiesene Person ·
-
triage-needed
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
microsoft/vscode-python-debugger#1095 · 1 Kommentar · 1 Reaktion ·
Alle Issues in microsoft/vscode-python-debugger
Ähnliche Issues
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
-
Mend: dependency security vulnerability untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100