Skip to content
Snippets Groups Projects
Commit c71a6a68 authored by George Nachman's avatar George Nachman
Browse files

Make sure servers get killed on user-initiated quit. If we just HUP the shell...

Make sure servers get killed on user-initiated quit. If we just HUP the shell then the server won't notice until it becomes attached as an orphan on the next launch. Issue 6369
parent 868d531b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1794,7 +1794,7 @@ ITERM_WEAKLY_REFERENCEABLE
[self replaceTerminatedShellWithNewInstance];
} else {
_shouldRestart = YES;
[_shell sendSignal:SIGKILL];
[_shell sendSignal:SIGKILL toServer:NO];
}
}
 
Loading
Loading
Loading
Loading
@@ -70,7 +70,7 @@ extern NSString *kCoprocessStatusChangeNotification;
 
- (void)writeTask:(NSData*)data;
 
- (void)sendSignal:(int)signo;
- (void)sendSignal:(int)signo toServer:(BOOL)toServer;
 
// Cause the slave to receive a SIGWINCH and change the tty's window size. If `size` equals the
// tty's current window size then no action is taken.
Loading
Loading
Loading
Loading
@@ -828,8 +828,11 @@ static int MyForkPty(int *amaster,
[self.delegate threadedTaskBrokenPipe];
}
 
- (void)sendSignal:(int)signo {
if (_serverChildPid != -1) {
- (void)sendSignal:(int)signo toServer:(BOOL)toServer {
if (toServer && _serverPid != -1) {
DLog(@"Sending signal to server %@", @(_serverPid));
kill(_serverPid, signo);
} else if (_serverChildPid != -1) {
kill(_serverChildPid, signo);
} else if (_childPid >= 0) {
kill(_childPid, signo);
Loading
Loading
@@ -931,7 +934,7 @@ static int MyForkPty(int *amaster,
- (void)stop {
self.paused = NO;
[self stopLogging];
[self sendSignal:SIGHUP];
[self sendSignal:SIGHUP toServer:NO];
[self killServerIfRunning];
 
if (fd >= 0) {
Loading
Loading
Loading
Loading
@@ -1370,7 +1370,10 @@ static iTermController *gSharedInstance;
assert([iTermAdvancedSettingsModel runJobsInServers]);
for (iTermRestorableSession *restorableSession in _restorableSessions) {
for (PTYSession *aSession in restorableSession.sessions) {
[aSession.shell sendSignal:SIGHUP];
if (aSession.shell.serverPid != -1) {
[aSession.shell sendSignal:SIGKILL toServer:YES];
}
[aSession.shell sendSignal:SIGHUP toServer:YES];
}
}
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment