Open thesoftwarephilosopher opened 2 years ago
Did you look at https://code.visualstudio.com/docs/editor/tasks#_output-behavior information?
A new terminal also always opens (not great)
Do you mean the terminal that the task runs in?
A new terminal also always opens (not great)
Do you mean the terminal that the task runs in?
Two terminals open: bash and task. Task should be there. Bash should not. This only happens when I have the automatic task runner thing on for folderOpen
.
But in another project, the extra bash
did not open.
And on further reflection, once I open bash
in a VS Code terminal, even after I close it, subsequent openings of that same VS Code workspace/window will open bash
without asking me, as soon as I open the window. This is already frustrating and has been happening for months.
So I think the bug of this issue is probably related to that.
This looks like terminal persistence. @Tyriar FYI.
@sdegutis VS Code has a feature that restores your terminal session. If you close your bash
terminal in a workspace, does it still come back when you next open that workspace?
You can entirely disable the terminal persistence feature with the setting terminal.integrated.enablePersistentSessions: false
.
@sdegutis VS Code has a feature that restores your terminal session. If you close your
bash
terminal in a workspace, does it still come back when you next open that workspace?
Yes. That's the problem.
You can entirely disable the terminal persistence feature with the setting
terminal.integrated.enablePersistentSessions: false
.
But I like it. Just not its bugs.
Reproes with or without terminal persistence enabled, believe it's related to showPanel
very strange - I can repro in an Insider's window, but not in OSS using the same repo and tasks.json
In insider's, where the bug can be reproduced, I see that 2 tasks are found when there should only be one. It looks like the
and the command
is getting passed into shellLaunchConfig
as the executable
wish I could debug this in OSS - the source maps are taking a long time to load and then the window becomes unresponsive. any idea why this might not repro there? @alexr00
@meganrogge I can't reproduce the 2 automatic tasks found. I also can't reproduce the issue if I disable terminal persistence. I can repro with OSS.
The two things that immediately come to mind for why something might not repro in OSS are minification and timing. Since I'm running all this on a fast desktop, and we have different situations under which this repros, I would guess timing.
update tasks.json file to this:
{ "version": "2.0.0", "tasks": [ { "type": "npm", "script": "watch", "group": "build", "problemMatcher": [], "label": "npm: watch", "detail": "tsc --watch", "runOptions": { "runOn": "folderOpen", "instanceLimit": 1 }, "presentation": { "reveal": "silent", "echo": false }, "options": { "env": { "DISABLE_TERMINAL_PERSISTENCE": "1" } } } ] }
It disables terminal persistence for a task.
@markw65 has been looking into some issues related to this, one of his PRs might fix this. I'll be testing them next week
@markw65 has been looking into some issues related to this, one of his PRs might fix this
I don't think that's likely, I'm afraid.
I see that 2 tasks are found when there should only be one
I think thats just a misleading message.
It's printing RunAutomaticTasks: Found ${workspaceTasks.size} automatic tasks
, where workspaceTasks
is a map from workspace folder uris to the set of tasks found there:
In my case, there are two entries. One is the actual workspace folder, with one task, and the other is "settings", with no tasks. It seems that "settings" are tasks inferred from the User's settings.json - and in my case, there are none. I'm not sure when there would be such tasks...
If I then step into the next function, it correctly extracts and launches the single task.
But I think all this is a side issue; the unwanted terminal has already been created by the time it starts running the automatic tasks. And I think that happens when the bottom panel is shown.
In fact, without any tasks, auto-run or otherwise, I can sort of repro this issue.
Start with the terminal panel open. Kill all the terminals. The entire bottom panel disappears. Now re-open it, eg via Cmd-Shift-M to show the problems panel, and then switch to the terminal panel. You'll see that a shell starts running. In other words, showing the terminal panel will start a shell if there are no other terminals.
So I think the problem is simply that vscode remembers that the terminal panel was selected.
So the fix might be as simple as not restoring the active panel until after the auto-run tasks have run.
I think thats just a misleading message.
In fact its a very misleading message... the "set" field in each entry in the workspaceTasks
map actually includes all tasks, not just the auto-run tasks; so you can't fix the message by simply adding up the sizes of the sets across all the entries in the map. The next step does correctly filter them out though, so its only the trace message which is broken...
Actually, at the time you wrote about seeing two tasks, the code really was reporting the number of auto-run tasks found; it was (inadvertently by the looks of things) changed to report the number of places that it looked for tasks in 1715e06. So perhaps the two tasks thing is a separate issue, and still there...
This no longer happens
I can still reproduce the problem:
foo
with the .vscode/tasks.json
from the description (or from [comment(https://github.com/microsoft/vscode/issues/142796#issuecomment-1518941799))foo
again from the recent foldersbash
terminal appears againAny update? I'm still getting new bash terminals started basically always, ones that I didn't open or want opened, and I can't prevent it. I have to close them every single time I open any project window.
Issue Type: Bug
If I add this to
.vscode/tasks.json
:And I open a new window:
VS Code version: Code 1.64.2 (f80445acd5a3dadef24aa209168452a3d97cc326, 2022-02-09T22:02:28.252Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No