Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes/No 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: 1.65.0-insider OS Version: MacOS12.2.2 Steps to Reproduce: with setting new terminal <img width="1440" alt="image" src="https://user-"
Thanks, we're aware of this issue and have been working toward its resolution

Discussion:
'!**/*.icns', '!**/*.xml', '!**/*.sh', <ins> '!**/*.zsh', </ins> '!**/*.txt', '!**/*.xpm', '!**/*.opts',

'out-build/vs/base/node/ps.sh', // Terminal shell integration <del> 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh', 'out-build/vs/workbench/contrib/terminal/browser/media/.zshrc', </del> 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1', <ins> 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh', 'out-build/vs/workbench/contrib/terminal/browser/media/shellIntegration.zsh', </ins> '!**/test/**' ];

'out-build/vs/workbench/contrib/debug/**/*.json', 'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt', 'out-build/vs/workbench/contrib/terminal/browser/media/*.ps1', <del> 'out-build/vs/workbench/contrib/terminal/browser/media/.zshrc', </del> 'out-build/vs/workbench/contrib/terminal/browser/media/*.sh', <ins> 'out-build/vs/workbench/contrib/terminal/browser/media/*.zsh', </ins> 'out-build/vs/workbench/contrib/webview/browser/pre/*.js', 'out-build/vs/**/markdown.css', 'out-build/vs/workbench/contrib/tasks/**/*.json',

*--------------------------------------------------------------------------------------------*/ import { exec } from 'child_process'; <ins> import { promises as fs } from 'fs'; </ins> import type * as pty from 'node-pty'; <ins> import { tmpdir } from 'os'; </ins> import { timeout } from 'vs/base/common/async'; import { Emitter, Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; <ins> import { FileAccess } from 'vs/base/common/network'; </ins> import * as path from 'vs/base/common/path'; import { IProcessEnvironment, isLinux, isMacintosh, isWindows } from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri';

return firstError; } <ins> // Handle zsh shell integration - Set $ZDOTDIR to a temp dir and create $ZDOTDIR/.zshrc if (this.shellLaunchConfig.env?.['_ZDOTDIR'] === '1') { const zdotdir = path.join(tmpdir(), 'vscode-zsh'); await fs.mkdir(zdotdir, { recursive: true }); const source = path.join(path.dirname(FileAccess.asFileUri('', require).fsPath), 'out/vs/workbench/contrib/terminal/browser/media/shellIntegration.zsh'); await fs.copyFile(source, path.join(zdotdir, '.zshrc')); this._ptyOptions.env = this._ptyOptions.env || {}; this._ptyOptions.env['ZDOTDIR'] = zdotdir; delete this._ptyOptions.env['_ZDOTDIR']; } </ins> try { await this.setupPtyProcess(this.shellLaunchConfig, this._ptyOptions); return undefined;

<del> # --------------------------------------------------------------------------------------------- #   Copyright (c) Microsoft Corporation. All rights reserved. #   Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------------------------------- autoload -Uz add-zsh-hook IN_COMMAND_EXECUTION="1" LAST_HISTORY_ID=0 prompt_start() { printf "033]633;A007" } prompt_end() { printf "033]633;B007" } update_cwd() { printf "033]633;P;Cwd=%s007" "$PWD" } command_output_start() { printf "033]633;C007" } continuation_start() { printf "033]633;F007" } continuation_end() { printf "033]633;G007" } command_complete() { local HISTORY_ID=$(history | tail -n1 | awk '{print $1;}') if [[ "$HISTORY_ID" == "$LAST_HISTORY_ID" ]]; then printf "033]633;D007" else printf "033]633;D;%s007" "$STATUS" LAST_HISTORY_ID=$HISTORY_ID fi update_cwd } update_prompt() { PRIOR_PROMPT="$PS1" IN_COMMAND_EXECUTION="" PS1="$(prompt_start)$PREFIX$PS1$(prompt_end)" PS2="$(continuation_start)$PS2$(continuation_end)" } precmd() { local STATUS="$?" if [ -z "${IN_COMMAND_EXECUTION-}" ]; then # not in command execution command_output_start fi command_complete "$STATUS" # in command execution if [ -n "$IN_COMMAND_EXECUTION" ]; then # non null update_prompt fi } preexec() { PS1="$PRIOR_PROMPT" IN_COMMAND_EXECUTION="1" command_output_start } add-zsh-hook precmd precmd add-zsh-hook preexec preexec # Show the welcome message if [ -z "${VSCODE_SHELL_HIDE_WELCOME-}" ]; then echo "033[1;32mShell integration activated033[0m" else VSCODE_SHELL_HIDE_WELCOME="" fi </del>

<ins> # --------------------------------------------------------------------------------------------- #   Copyright (c) Microsoft Corporation. All rights reserved. #   Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------------------------------- autoload -Uz add-zsh-hook IN_COMMAND_EXECUTION="1" LAST_HISTORY_ID=0 prompt_start() { printf "033]633;A007" } prompt_end() { printf "033]633;B007" } update_cwd() { printf "033]633;P;Cwd=%s007" "$PWD" } command_output_start() { printf "033]633;C007" } continuation_start() { printf "033]633;F007" } continuation_end() { printf "033]633;G007" } command_complete() { local HISTORY_ID=$(history | tail -n1 | awk '{print $1;}') if [[ "$HISTORY_ID" == "$LAST_HISTORY_ID" ]]; then printf "033]633;D007" else printf "033]633;D;%s007" "$STATUS" LAST_HISTORY_ID=$HISTORY_ID fi update_cwd } update_prompt() { PRIOR_PROMPT="$PS1" IN_COMMAND_EXECUTION="" PS1="$(prompt_start)$PREFIX$PS1$(prompt_end)" PS2="$(continuation_start)$PS2$(continuation_end)" } precmd() { local STATUS="$?" if [ -z "${IN_COMMAND_EXECUTION-}" ]; then # not in command execution command_output_start fi command_complete "$STATUS" # in command execution if [ -n "$IN_COMMAND_EXECUTION" ]; then # non null update_prompt fi } preexec() { PS1="$PRIOR_PROMPT" IN_COMMAND_EXECUTION="1" command_output_start } add-zsh-hook precmd precmd add-zsh-hook preexec preexec # Show the welcome message if [ -z "${VSCODE_SHELL_HIDE_WELCOME-}" ]; then echo "033[1;32mShell integration activated033[0m" else VSCODE_SHELL_HIDE_WELCOME="" fi </ins>

shellLaunchConfig.env = shellLaunchConfig.env || {} as IProcessEnvironment; shellLaunchConfig.env['VSCODE_SHELL_LOGIN'] = '1'; } <del> if (env?.['ZDOTDIR']) { </del> <ins> if (env?.['_ZDOTDIR']) { </ins> shellLaunchConfig.env = shellLaunchConfig.env || {} as IProcessEnvironment; <del> shellLaunchConfig.env['ZDOTDIR'] = env['ZDOTDIR'].replace('${execInstallFolder}', remoteEnv.appRoot.fsPath); </del> <ins> shellLaunchConfig.env['_ZDOTDIR'] = '1'; </ins> } newProcess = await backend.createProcess(

const shellIntegration = terminalEnvironment.injectShellIntegrationArgs(this._logService, this._configurationService, env, this._configHelper.config.shellIntegration?.enabled || false, shellLaunchConfig, OS); if (shellIntegration.enableShellIntegration) { shellLaunchConfig.args = shellIntegration.args; <del> if (env?.['ZDOTDIR']) { </del> <ins> if (env?.['_ZDOTDIR']) { </ins> shellLaunchConfig.env = shellLaunchConfig.env || {} as IProcessEnvironment; <del> const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(Schemas.file); const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined; const resolved = await this._configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, env['ZDOTDIR']); env['ZDOTDIR'] = resolved; </del> <ins> shellLaunchConfig.env['_ZDOTDIR'] = '1'; </ins> } // Always resolve the injected arguments on local processes await this._terminalProfileResolverService.resolveShellLaunchConfig(shellLaunchConfig, {

} else if (originalArgs === shellIntegrationArgs.get(ShellIntegrationExecutable.Zsh) || originalArgs === shellIntegrationArgs.get(ShellIntegrationExecutable.ZshLogin)) { newArgs = originalArgs; } <del> // Set the ZDOTDIR to be the dir of the shell integration script so that it runs // as a .zshrc file and the autoload hook will work and set precmd and preexec correctly env['ZDOTDIR'] = '${execInstallFolder}/out/vs/workbench/contrib/terminal/browser/media'; </del> <ins> // Set _ZDOTDIR which will defer setting ZDOTDIR to the pty host env['_ZDOTDIR'] = '1'; </ins> const showWelcome = configurationService.getValue(TerminalSettingId.ShellIntegrationShowWelcome); if (!showWelcome) { env['VSCODE_SHELL_HIDE_WELCOME'] = '1';