提交 bae64c4d 编写于 作者: D Daniel Imms

Fork terminalProcess using amd, convert to TS

Fixes #27182
上级 5f0e3247
......@@ -25,7 +25,9 @@ exports.collectModules = function (excludes) {
createModuleDescription('vs/workbench/services/search/node/worker/searchWorkerApp', []),
createModuleDescription('vs/workbench/services/files/node/watcher/unix/watcherApp', []),
createModuleDescription('vs/workbench/node/extensionHostProcess', [])
createModuleDescription('vs/workbench/node/extensionHostProcess', []),
createModuleDescription('vs/workbench/parts/terminal/node/terminalProcess', [])
];
return modules;
......
......@@ -473,8 +473,8 @@ export class TerminalInstance implements ITerminalInstance {
}
const env = TerminalInstance.createTerminalEnv(process.env, shell, this._getCwd(shell, workspace), locale, this._cols, this._rows);
this._title = shell.name || '';
this._process = cp.fork('../node/terminalProcess', [], {
env: env,
this._process = cp.fork(URI.parse(require.toUrl('bootstrap')).fsPath, ['--type=terminal'], {
env,
cwd: URI.parse(path.dirname(require.toUrl('../node/terminalProcess'))).fsPath
});
if (!shell.name) {
......@@ -622,6 +622,7 @@ export class TerminalInstance implements ITerminalInstance {
env['PTYCOLS'] = cols.toString();
env['PTYROWS'] = rows.toString();
}
env['AMD_ENTRYPOINT'] = 'vs/workbench/parts/terminal/node/terminalProcess';
return env;
}
......
......@@ -3,21 +3,23 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var fs = require('fs');
var os = require('os');
var path = require('path');
var ptyJs = require('node-pty');
import * as fs from 'fs';
fs.writeFileSync('/home/daniel/testing-terminal-1', 'foo');
import * as os from 'os';
import * as path from 'path';
import * as ptyJs from 'node-pty';
fs.writeFileSync('/home/daniel/testing-terminal-2', 'foo');
// The pty process needs to be run in its own child process to get around maxing out CPU on Mac,
// see https://github.com/electron/electron/issues/38
var name;
var shellName: string;
if (os.platform() === 'win32') {
name = path.basename(process.env.PTYSHELL);
shellName = path.basename(process.env.PTYSHELL);
} else {
// Using 'xterm-256color' here helps ensure that the majority of Linux distributions will use a
// color prompt as defined in the default ~/.bashrc file.
name = 'xterm-256color';
shellName = 'xterm-256color';
}
var shell = process.env.PTYSHELL;
var args = getArgs();
......@@ -29,16 +31,26 @@ var currentTitle = '';
setupPlanB(process.env.PTYPID);
cleanEnv();
var options = {
name: name,
cwd: cwd
interface IOptions {
name: string;
cwd: string;
cols?: number;
rows?: number;
}
var options: IOptions = {
name: shellName,
cwd
};
if (cols && rows) {
options.cols = parseInt(cols, 10);
options.rows = parseInt(rows, 10);
}
fs.writeFileSync('/home/daniel/testing-terminal-3', 'foo');
var ptyProcess = ptyJs.fork(shell, args, options);
fs.writeFileSync('/home/daniel/testing-terminal-4', 'foo');
var closeTimeout;
var exitCode;
......@@ -93,6 +105,7 @@ function getArgs() {
function cleanEnv() {
var keys = [
'AMD_ENTRYPOINT',
'ELECTRON_RUN_AS_NODE',
'PTYCWD',
'PTYPID',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册