kopia lustrzana https://github.com/c9/core
fix close event handling for remote processes
rodzic
96426b0c56
commit
75beb096d7
|
@ -273,15 +273,18 @@ function Consumer() {
|
|||
function onExit(pid, code, signal) {
|
||||
var process = proxyProcesses[pid];
|
||||
if (!process) return;
|
||||
// TODO: not delete proxy if close is going to be called later.
|
||||
// but somehow do delete proxy if close won't be called later.
|
||||
delete proxyProcesses[pid];
|
||||
// TODO: how can we confirm that both close and exit are always called
|
||||
if (process.closed)
|
||||
delete proxyProcesses[pid];
|
||||
process.exited = true;
|
||||
process.emit("exit", code, signal);
|
||||
}
|
||||
function onProcessClose(pid) {
|
||||
var process = proxyProcesses[pid];
|
||||
if (!process) return;
|
||||
delete proxyProcesses[pid];
|
||||
if (process.exited)
|
||||
delete proxyProcesses[pid];
|
||||
process.closed = true;
|
||||
process.emit("close");
|
||||
}
|
||||
function onPtyKill(pid){
|
||||
|
|
|
@ -955,7 +955,8 @@ define(function(require, exports, module) {
|
|||
|
||||
if (isOutputTerminal) {
|
||||
session.connect = function(){
|
||||
session.connect = function(){};
|
||||
if (session.pty && !session.pty.closed)
|
||||
return;
|
||||
|
||||
// Connect to a new or attach to an existing tmux session
|
||||
createTerminal(session, e.state);
|
||||
|
|
|
@ -77,7 +77,7 @@ module.exports = function(c9, proc, installPath, shell) {
|
|||
meta.process.stderr.on("data", function(data) {
|
||||
errBuffer += data.toString();
|
||||
});
|
||||
meta.process.on("exit", function() {
|
||||
meta.process.on("close", function() {
|
||||
if (!buffer && !errBuffer && options.retries < 4) {
|
||||
// tmux doesn't produce any output if two instances are invoked at the same time
|
||||
return setTimeout(function() {
|
||||
|
@ -207,6 +207,9 @@ module.exports = function(c9, proc, installPath, shell) {
|
|||
delete session.pty;
|
||||
};
|
||||
|
||||
pty.on("close", function(){
|
||||
pty.closed = true;
|
||||
});
|
||||
session.pty.on("exit", function(){
|
||||
if (!disregarded) {
|
||||
session.connected = false;
|
||||
|
|
Ładowanie…
Reference in New Issue