|
2 | 2 | // Licensed under the MIT License.
|
3 | 3 |
|
4 | 4 | import cp = require("child_process");
|
5 |
| -import fs = require("fs"); |
6 |
| -import net = require("net"); |
7 |
| -import os = require("os"); |
| 5 | +import * as semver from "semver"; |
8 | 6 | import path = require("path");
|
9 | 7 | import vscode = require("vscode");
|
10 | 8 | import { Logger } from "./logging";
|
@@ -104,14 +102,20 @@ export class PowerShellProcess {
|
104 | 102 | utils.deleteSessionFile(this.sessionFilePath);
|
105 | 103 |
|
106 | 104 | // Launch PowerShell in the integrated terminal
|
107 |
| - this.consoleTerminal = |
108 |
| - vscode.window.createTerminal({ |
109 |
| - name: this.title, |
110 |
| - shellPath: this.exePath, |
111 |
| - shellArgs: powerShellArgs, |
112 |
| - hideFromUser: !this.sessionSettings.integratedConsole.showOnStartup, |
113 |
| - cwd: this.sessionSettings.cwd |
114 |
| - }); |
| 105 | + const terminalOptions: vscode.TerminalOptions = { |
| 106 | + name: this.title, |
| 107 | + shellPath: this.exePath, |
| 108 | + shellArgs: powerShellArgs, |
| 109 | + hideFromUser: !this.sessionSettings.integratedConsole.showOnStartup, |
| 110 | + cwd: this.sessionSettings.cwd, |
| 111 | + }; |
| 112 | + |
| 113 | + // This API is available only in newer versions of VS Code. |
| 114 | + if (semver.gte(vscode.version, "1.65.0")) { |
| 115 | + (terminalOptions as any).isTransient = true; |
| 116 | + } |
| 117 | + |
| 118 | + this.consoleTerminal = vscode.window.createTerminal(terminalOptions); |
115 | 119 |
|
116 | 120 | const pwshName = path.basename(this.exePath);
|
117 | 121 | this.log.write(`${pwshName} started.`);
|
|
0 commit comments