Repository: vscode
Issue: (MacOS) `terminal.integrated.env.osx` Breaks PATH Modifications from Login Shell
Labels: bug,confirmation-pending,terminal-process

Type: <b>Bug</b>

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: Version: 1.79.2 (Universal)
- OS: OS: Darwin x64 20.6.0
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:58:52.392Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0

## Bug

If the system's PATH is modified by a user's startup script (such as `~/.zshrc`)  _and_ `"terminal.integrated.env.osx"`, then VS Code will bulldoze the environment setup from the user's startup script for any Tasks that are run.

This is relevant for any user toolchain setup for task integration.  For example, GNU Make version 4+.  Users are required to prepend a path to get Make version 4+ accessible as `make` since Homebrew installs it as `gmake`.  The recommended instructions involve doing this from `~/.zshrc`.

## Steps to reproduce (on MacOS):

1. Edit your shell startup script to prepend a variable.  The following is the only content in my `~/.zshrc`:
```bash
PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
```
2. Open an empty folder with all extensions disabled
3. Create a `.vscode/tasks.json` file with the following contents:
```json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "My Task",
            "command": "echo $0 && echo $PATH",
            "type": "shell",
            "args": [],
            "presentation": {
                "reveal": "always"
            },
            "group": "build"
        }
    ]
}
```
3. Run the build task with `Command+Shift+B`.
4. Validate the startup script ran by seeing the expected PATH in the output:
```bash
 *  Executing task: echo $0 && echo $PATH 

/bin/zsh
/usr/local/opt/make/libexec/gnubin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
```
5. Add a `.vscode/settings.json` to the project with the following contents:
```
{
    "terminal.integrated.env.osx": {
        "PATH":"TESTING:${env:PATH}"
    }
}
```
6. Save the file and immediately run the build task again.
7. See that the modifications of the PATH from the startup script are now missing.
```bash
 *  Executing task: echo $0 && echo $PATH 

/bin/zsh
TESTING:/usr/bin:/bin:/usr/sbin:/sbin
```

## Screenshot

<img width="1025" alt="Output" src="https://github.com/microsoft/vscode/assets/38844790/0967d235-ecd1-466d-9eaa-d51760620f20">


VS Code version: Code 1.79.2 (Universal) (695af097c7bd098fbf017ce3ac85e09bbc5dda06, 2023-06-14T08:58:52.392Z)
OS version: Darwin x64 20.6.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz (4 x 2600)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>metal: disabled_off<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|3, 3, 4|
|Memory (System)|8.00GB (0.12GB free)|
|Process Argv|--crash-reporter-id 0c0a4b87-124d-47e4-adf8-2c4635e59c83|
|Screen Reader|no|
|VM|0%|
</details>Extensions: none<details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30776702
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30610679
282f8724:30602487
pyind779:30671433
89544117:30613380
pythonsymbol12:30671437
2i9eh265:30646982
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
pythongtdpath:30769146
bgfeh915:30769767
e440d664:30776459
pythonidxpt:30772539
pythondjangotscf:30772537
pythonnoceb:30776495
h7j2d465:30772216

```

</details>

<!-- generated by issue reporter -->