mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Merge electron-browser/terminal into node/terminal
This commit is contained in:
@@ -14,7 +14,7 @@ import * as platform from 'vs/base/common/platform';
|
||||
import * as terminalCommands from 'vs/workbench/parts/terminal/common/terminalCommands';
|
||||
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, TerminalCursorStyle, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_NOT_VISIBLE } from 'vs/workbench/parts/terminal/common/terminal';
|
||||
import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/electron-browser/terminal';
|
||||
import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/node/terminal';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as os from 'os';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as processes from 'vs/base/node/processes';
|
||||
import { readFile, fileExists } from 'vs/base/node/pfs';
|
||||
|
||||
let _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string = null;
|
||||
export function getTerminalDefaultShellUnixLike(): string {
|
||||
if (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) {
|
||||
let unixLikeTerminal = 'sh';
|
||||
if (!platform.isWindows && process.env.SHELL) {
|
||||
unixLikeTerminal = process.env.SHELL;
|
||||
// Some systems have $SHELL set to /bin/false which breaks the terminal
|
||||
if (unixLikeTerminal === '/bin/false') {
|
||||
unixLikeTerminal = '/bin/bash';
|
||||
}
|
||||
}
|
||||
_TERMINAL_DEFAULT_SHELL_UNIX_LIKE = unixLikeTerminal;
|
||||
}
|
||||
return _TERMINAL_DEFAULT_SHELL_UNIX_LIKE;
|
||||
}
|
||||
|
||||
let _TERMINAL_DEFAULT_SHELL_WINDOWS: string = null;
|
||||
export function getTerminalDefaultShellWindows(): string {
|
||||
if (!_TERMINAL_DEFAULT_SHELL_WINDOWS) {
|
||||
const isAtLeastWindows10 = platform.isWindows && parseFloat(os.release()) >= 10;
|
||||
const is32ProcessOn64Windows = process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
|
||||
const powerShellPath = `${process.env.windir}\\${is32ProcessOn64Windows ? 'Sysnative' : 'System32'}\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
||||
_TERMINAL_DEFAULT_SHELL_WINDOWS = isAtLeastWindows10 ? powerShellPath : processes.getWindowsShell();
|
||||
}
|
||||
return _TERMINAL_DEFAULT_SHELL_WINDOWS;
|
||||
}
|
||||
|
||||
if (platform.isLinux) {
|
||||
const file = '/etc/os-release';
|
||||
fileExists(file).then(exists => {
|
||||
if (!exists) {
|
||||
return;
|
||||
}
|
||||
readFile(file).then(b => {
|
||||
const contents = b.toString();
|
||||
if (contents.indexOf('NAME=Fedora') >= 0) {
|
||||
isFedora = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export let isFedora = false;
|
||||
@@ -19,7 +19,7 @@ import { TerminalConfigHelper } from 'vs/workbench/parts/terminal/electron-brows
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/electron-browser/terminal';
|
||||
import { getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/node/terminal';
|
||||
import { TerminalPanel } from 'vs/workbench/parts/terminal/electron-browser/terminalPanel';
|
||||
import { TerminalTab } from 'vs/workbench/parts/terminal/browser/terminalTab';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as os from 'os';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as processes from 'vs/base/node/processes';
|
||||
import { readFile, fileExists } from 'vs/base/node/pfs';
|
||||
|
||||
export interface IMessageFromTerminalProcess {
|
||||
type: 'pid' | 'data' | 'title';
|
||||
content: number | string;
|
||||
@@ -27,3 +32,47 @@ export interface ITerminalChildProcess {
|
||||
on(event: 'exit', listener: (code: number) => void): this;
|
||||
on(event: 'message', listener: (message: IMessageFromTerminalProcess) => void): this;
|
||||
}
|
||||
|
||||
let _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string = null;
|
||||
export function getTerminalDefaultShellUnixLike(): string {
|
||||
if (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) {
|
||||
let unixLikeTerminal = 'sh';
|
||||
if (!platform.isWindows && process.env.SHELL) {
|
||||
unixLikeTerminal = process.env.SHELL;
|
||||
// Some systems have $SHELL set to /bin/false which breaks the terminal
|
||||
if (unixLikeTerminal === '/bin/false') {
|
||||
unixLikeTerminal = '/bin/bash';
|
||||
}
|
||||
}
|
||||
_TERMINAL_DEFAULT_SHELL_UNIX_LIKE = unixLikeTerminal;
|
||||
}
|
||||
return _TERMINAL_DEFAULT_SHELL_UNIX_LIKE;
|
||||
}
|
||||
|
||||
let _TERMINAL_DEFAULT_SHELL_WINDOWS: string = null;
|
||||
export function getTerminalDefaultShellWindows(): string {
|
||||
if (!_TERMINAL_DEFAULT_SHELL_WINDOWS) {
|
||||
const isAtLeastWindows10 = platform.isWindows && parseFloat(os.release()) >= 10;
|
||||
const is32ProcessOn64Windows = process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
|
||||
const powerShellPath = `${process.env.windir}\\${is32ProcessOn64Windows ? 'Sysnative' : 'System32'}\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
||||
_TERMINAL_DEFAULT_SHELL_WINDOWS = isAtLeastWindows10 ? powerShellPath : processes.getWindowsShell();
|
||||
}
|
||||
return _TERMINAL_DEFAULT_SHELL_WINDOWS;
|
||||
}
|
||||
|
||||
if (platform.isLinux) {
|
||||
const file = '/etc/os-release';
|
||||
fileExists(file).then(exists => {
|
||||
if (!exists) {
|
||||
return;
|
||||
}
|
||||
readFile(file).then(b => {
|
||||
const contents = b.toString();
|
||||
if (contents.indexOf('NAME=Fedora') >= 0) {
|
||||
isFedora = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export let isFedora = false;
|
||||
Reference in New Issue
Block a user