Skip to content

Commit 7f132c9

Browse files
author
Benjamin Pasero
committed
debt - use platform over node.js OS
1 parent 58912dd commit 7f132c9

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/vs/base/node/terminalEncoding.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* This code is also used by standalone cli's. Avoid adding dependencies to keep the size of the cli small.
88
*/
99
import { exec } from 'child_process';
10-
import * as os from 'os';
10+
import { isWindows } from 'vs/base/common/platform';
1111

1212
const windowsTerminalEncodings = {
1313
'437': 'cp437', // United States
@@ -53,7 +53,7 @@ export async function resolveTerminalEncoding(verbose?: boolean): Promise<string
5353
}
5454

5555
// Windows: educated guess
56-
else if (os.platform() === 'win32') {
56+
else if (isWindows) {
5757
rawEncodingPromise = new Promise<string>(resolve => {
5858
if (verbose) {
5959
console.log('Running "chcp" to detect terminal encoding...');

src/vs/code/node/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function main(argv: string[]): Promise<any> {
4343

4444
// Help
4545
if (args.help) {
46-
const executable = `${product.applicationName}${os.platform() === 'win32' ? '.exe' : ''}`;
46+
const executable = `${product.applicationName}${isWindows ? '.exe' : ''}`;
4747
console.log(buildHelpMessage(product.nameLong, executable, product.version, OPTIONS));
4848
}
4949

src/vs/platform/environment/node/argv.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as minimist from 'minimist';
7-
import * as os from 'os';
87
import { localize } from 'vs/nls';
8+
import { isWindows } from 'vs/base/common/platform';
99

1010
export interface ParsedArgs {
1111
_: string[];
@@ -364,7 +364,7 @@ export function buildHelpMessage(productName: string, executableName: string, ve
364364
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}][${localize('paths', 'paths')}...]`);
365365
help.push('');
366366
if (isPipeSupported) {
367-
if (os.platform() === 'win32') {
367+
if (isWindows) {
368368
help.push(localize('stdinWindows', "To read output from another program, append '-' (e.g. 'echo Hello World | {0} -')", executableName));
369369
} else {
370370
help.push(localize('stdinUnix', "To read from stdin, append '-' (e.g. 'ps aux | grep code | {0} -')", executableName));

src/vs/workbench/contrib/terminal/node/terminalProcess.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import * as os from 'os';
76
import * as path from 'vs/base/common/path';
87
import * as platform from 'vs/base/common/platform';
98
import * as pty from 'node-pty';
@@ -53,7 +52,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
5352
) {
5453
super();
5554
let name: string;
56-
if (os.platform() === 'win32') {
55+
if (platform.isWindows) {
5756
name = path.basename(this._shellLaunchConfig.executable || '');
5857
} else {
5958
// Using 'xterm-256color' here helps ensure that the majority of Linux distributions will use a

0 commit comments

Comments
 (0)