Skip to content

Commit

Permalink
debt - use platform over node.js OS
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Jun 22, 2020
1 parent 58912dd commit 7f132c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/vs/base/node/terminalEncoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* This code is also used by standalone cli's. Avoid adding dependencies to keep the size of the cli small.
*/
import { exec } from 'child_process';
import * as os from 'os';
import { isWindows } from 'vs/base/common/platform';

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

// Windows: educated guess
else if (os.platform() === 'win32') {
else if (isWindows) {
rawEncodingPromise = new Promise<string>(resolve => {
if (verbose) {
console.log('Running "chcp" to detect terminal encoding...');
Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function main(argv: string[]): Promise<any> {

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

Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/environment/node/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import * as minimist from 'minimist';
import * as os from 'os';
import { localize } from 'vs/nls';
import { isWindows } from 'vs/base/common/platform';

export interface ParsedArgs {
_: string[];
Expand Down Expand Up @@ -364,7 +364,7 @@ export function buildHelpMessage(productName: string, executableName: string, ve
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}][${localize('paths', 'paths')}...]`);
help.push('');
if (isPipeSupported) {
if (os.platform() === 'win32') {
if (isWindows) {
help.push(localize('stdinWindows', "To read output from another program, append '-' (e.g. 'echo Hello World | {0} -')", executableName));
} else {
help.push(localize('stdinUnix', "To read from stdin, append '-' (e.g. 'ps aux | grep code | {0} -')", executableName));
Expand Down
3 changes: 1 addition & 2 deletions src/vs/workbench/contrib/terminal/node/terminalProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

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

0 comments on commit 7f132c9

Please sign in to comment.