diff svr-chansession.c @ 1835:90ac15aeac43

Bring back recently removed channel->flushing This resolves the "sleep 10&echo hello" case which should return immediately
author Matt Johnston <matt@codeconstruct.com.au>
date Thu, 14 Oct 2021 20:55:15 +0800
parents c32976db772f
children 5c13e765ddbd
line wrap: on
line diff
--- a/svr-chansession.c	Tue Oct 12 23:32:10 2021 +0800
+++ b/svr-chansession.c	Thu Oct 14 20:55:15 2021 +0800
@@ -54,7 +54,7 @@
 static void cleanupchansess(const struct Channel *channel);
 static int newchansess(struct Channel *channel);
 static void chansessionrequest(struct Channel *channel);
-static int sesscheckclose(const struct Channel *channel);
+static int sesscheckclose(struct Channel *channel);
 
 static void send_exitsignalstatus(const struct Channel *channel);
 static void send_msg_chansess_exitstatus(const struct Channel * channel,
@@ -77,9 +77,13 @@
 
 /* Returns whether the channel is ready to close. The child process
    must not be running (has never started, or has exited) */
-static int sesscheckclose(const struct Channel *channel) {
+static int sesscheckclose(struct Channel *channel) {
 	struct ChanSess *chansess = (struct ChanSess*)channel->typedata;
 	TRACE(("sesscheckclose, pid %d, exitpid %d", chansess->pid, chansess->exit.exitpid))
+
+	if (chansess->exit.exitpid != -1) {
+		channel->flushing = 1;
+	}
 	return chansess->pid == 0 || chansess->exit.exitpid != -1;
 }