1
>
/*---------------------------------------------------------------------------------------------
terminalEnvironment.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { OperatingSystem, OS } from '../../../base/common/platform.js';
7
>
import { IShellLaunchConfig, TerminalShellType, PosixShellType, WindowsShellType, GeneralShellType } from './terminal.js';
8
>
9
>
/**
10
>
* Aggressively escape non-windows paths to prepare for being sent to a shell. This will do some
11
>
* escaping inaccurately to be careful about possible script injection via the file path. For
12
>
* example, we're trying to prevent this sort of attack: `/foo/file$(echo evil)`.
13
>
*/
14
>
export function escapeNonWindowsPath(path: string, shellType?: TerminalShellType): string {
15
let newPath = path;
16
if (newPath.includes('\\')) {