Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: build_tools/naclprocess.js

Issue 1742043002: Make M-x shell work in emacs. (Closed) Base URL: https://chromium.googlesource.com/webports.git@master
Patch Set: fix Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build_tools/pipeserver.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* jshint evil: true */ 7 /* jshint evil: true */
8 /* globals PipeServer */ 8 /* globals PipeServer */
9 9
10 'use strict'; 10 'use strict';
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 return; 1149 return;
1150 } 1150 }
1151 1151
1152 if (self.ttyWidth === null || self.ttyHeight === null) { 1152 if (self.ttyWidth === null || self.ttyHeight === null) {
1153 console.log('tty size not set! Call onTerminalResize.'); 1153 console.log('tty size not set! Call onTerminalResize.');
1154 callback(-Errno.ENOEXEC); 1154 callback(-Errno.ENOEXEC);
1155 return; 1155 return;
1156 } 1156 }
1157 1157
1158 var fg = document.createElement('object'); 1158 var fg = document.createElement('object');
1159 self.foregroundProcess = fg;
1160 1159
1161 var ppid; 1160 var ppid;
1162 if (pid === -1) { 1161 if (pid === -1) {
1163 // Create new process 1162 // Create new process
1164 pid = self.pid; 1163 pid = self.pid;
1165 self.pid += 1; 1164 self.pid += 1;
1166 self.log("creating new process: " + pid); 1165 self.log("creating new process: " + pid);
1167 1166
1168 var pgid = parent ? self.processes[parent.pid].pgid : pid; 1167 var pgid = parent ? self.processes[parent.pid].pgid : pid;
1169 ppid = parent ? parent.pid : NaClProcessManager.INIT_PID; 1168 ppid = parent ? parent.pid : NaClProcessManager.INIT_PID;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 // TODO(bradnelson): Consider dropping this method of passing in parameters. 1295 // TODO(bradnelson): Consider dropping this method of passing in parameters.
1297 if (args.arg0 === undefined && args.arg1 === undefined && argv) { 1296 if (args.arg0 === undefined && args.arg1 === undefined && argv) {
1298 var argn = 0; 1297 var argn = 0;
1299 argv.forEach(function (arg) { 1298 argv.forEach(function (arg) {
1300 var argname = 'arg' + argn; 1299 var argname = 'arg' + argn;
1301 addParam(argname, arg); 1300 addParam(argname, arg);
1302 argn = argn + 1; 1301 argn = argn + 1;
1303 }); 1302 });
1304 } 1303 }
1305 1304
1306 self.pipeServer.addProcessPipes(fg.pid, params); 1305 // Add in process pipes, and only make the foreground process if started
1306 // by the current foreground process and not piped somewhere else.
1307 var routesStdin = self.pipeServer.addProcessPipes(fg.pid, params);
1308 if (!routesStdin &&
1309 (self.foregroundProcess === null ||
1310 self.foregroundProcess === parent)) {
1311 self.foregroundProcess = fg;
1312 }
1307 1313
1308 if (params[NaClProcessManager.ENV_SPAWN_MODE] === 1314 if (params[NaClProcessManager.ENV_SPAWN_MODE] ===
1309 NaClProcessManager.ENV_SPAWN_POPUP_VALUE) { 1315 NaClProcessManager.ENV_SPAWN_POPUP_VALUE) {
1310 var popup = new GraphicalPopup( 1316 var popup = new GraphicalPopup(
1311 fg, 1317 fg,
1312 parseInt(params[NaClProcessManager.ENV_POPUP_WIDTH] || 1318 parseInt(params[NaClProcessManager.ENV_POPUP_WIDTH] ||
1313 NaClProcessManager.POPUP_WIDTH_DEFAULT, 10), 1319 NaClProcessManager.POPUP_WIDTH_DEFAULT, 10),
1314 parseInt(params[NaClProcessManager.ENV_POPUP_HEIGHT] || 1320 parseInt(params[NaClProcessManager.ENV_POPUP_HEIGHT] ||
1315 NaClProcessManager.POPUP_HEIGHT_DEFAULT, 10), 1321 NaClProcessManager.POPUP_HEIGHT_DEFAULT, 10),
1316 argv[0] 1322 argv[0]
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 */ 1490 */
1485 NaClProcessManager.prototype.sendStdinForeground = function (str) { 1491 NaClProcessManager.prototype.sendStdinForeground = function (str) {
1486 if (!this.foregroundProcess) { 1492 if (!this.foregroundProcess) {
1487 throw new Error(NaClProcessManager.NO_FG_ERROR); 1493 throw new Error(NaClProcessManager.NO_FG_ERROR);
1488 } 1494 }
1489 1495
1490 var message = {}; 1496 var message = {};
1491 message[NaClProcessManager.prefix] = str; 1497 message[NaClProcessManager.prefix] = str;
1492 this.foregroundProcess.postMessage(message); 1498 this.foregroundProcess.postMessage(message);
1493 }; 1499 };
OLDNEW
« no previous file with comments | « no previous file | build_tools/pipeserver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698