Repository: vscode
Issue: Second invocation of "Rerun Last Task" fails to launch terminal process
Labels: bug,help wanted,tasks,confirmed


Type: <b>Bug</b>

### Steps

1. Run a task (e.g. a custom test task) configured with `"runOptions": { "reevaluateOnRerun": false }`.
2. Run the command "Tasks: Rerun Last Task"
3. Run the command "Tasks: Rerun Last Task" a second time

### Expected

The task is rerun for a second time (third execution of the task overall).

### Actual

Task begins executing then fails to launch with message:

```
The terminal process failed to launch: Path to shell executable "\usr\bin\zsh" does not exist.
```

### Additional context

This likely has something to do with running VSCode on Windows remotely connected to Ubuntu-20.04 via WSL2. Evidence of this is the use of backslashes in the path: "\usr\bin\zsh". It seems that, for some reason, the second re-run tries to execute the task using the host filesystem instead of the remote filesystem.

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

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz (4 x 3506)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.94GB (18.85GB free)|
|Process Argv|--folder-uri=vscode-remote://wsl+Ubuntu-20.04/home/z/dev/mneme --remote=wsl+Ubuntu-20.04 --crash-reporter-id 0befafd8-3898-4c21-9e05-b7204c2b3f66|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: Ubuntu-20.04|
|OS|Linux x64 5.15.79.1-microsoft-standard-WSL2|
|CPUs|Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz (4 x 3506)|
|Memory (System)|15.59GB (13.74GB free)|
|VM|0%|
</details><details><summary>Extensions (36)</summary>

Extension|Author (truncated)|Version
---|---|---
jsonl|Alp|0.0.1
vsc-material-theme|Equ|33.6.0
vsc-material-theme-icons|equ|2.5.0
vscode-graphql-syntax|Gra|1.0.6
endwise|kai|1.5.1
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
remote-explorer|ms-|0.2.0
surface|msa|0.7.0
language-liquid|nei|0.1.1
phoenix|pho|0.1.2
vim|vsc|1.24.3
vscode-zipfs|arc|3.0.0
chronicler|arc|0.1.16
procfile|ben|1.1.7
vscode-tailwindcss|bra|0.9.7
solargraph|cas|0.24.0
vscode-eslint|dba|2.4.0
gitlens|eam|13.2.0
EditorConfig|Edi|0.16.4
prettier-vscode|esb|9.10.4
vscode-graphql|Gra|0.8.5
vscode-graphql-syntax|Gra|1.0.6
elixir-ls|Jak|0.13.0
vscode-language-babel|mgm|0.0.36
vscode-docker|ms-|1.23.3
react-proptypes-intellisense|OfH|1.0.3
vscode-versionlens|pfl|1.5.0
prisma|Pri|4.10.1
trailing-spaces|sha|0.4.1
stately-vscode|sta|1.11.3
even-better-toml|tam|0.19.0
simple-ruby-erb|vor|0.2.1

(7 theme extensions excluded)

</details>
<!-- generated by issue reporter -->