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

Tmux 2.1 and earlier throw an error when you give new-window -c a bogus...

Tmux 2.1 and earlier throw an error when you give new-window -c a bogus directory. Improve our error reporting in this case and in all cases to show the command response.
Issue 5847
parent 862448da
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -87,10 +87,9 @@ static NSString *kCommandIsLastInList = @"lastInList";
[super dealloc];
}
 
- (void)abortWithErrorMessage:(NSString *)message
{
[self abortWithErrorMessage:[NSString stringWithFormat:@"Reason: %@", message]
title:@"A tmux protocol error occurred."];
- (void)abortWithErrorMessage:(NSString *)message {
[self abortWithErrorMessage:[NSString stringWithFormat:@"%@", message]
title:@"tmux Reported a Problem"];
}
 
- (void)abortWithErrorMessage:(NSString *)message title:(NSString *)title {
Loading
Loading
@@ -314,7 +313,15 @@ error:
withObject:nil
withObject:obj];
} else {
[self abortWithErrorMessage:[NSString stringWithFormat:@"Error: %@", currentCommand_]];
if ([currentCommandResponse_ hasPrefix:@"bad working directory:"] &&
[currentCommand_[kCommandString] hasPrefix:@"new-window"] &&
[currentCommand_[kCommandString] containsString:@"-c"] &&
[self.maximumServerVersion compare:@2.1] != NSOrderedAscending) {
[self abortWithErrorMessage:[NSString stringWithFormat:@"Error: %@.\n\nTmux 2.1 and earlier will refuse to create a new window pane with a nonexistant initial working directory.\n\nInfo:\n%@",
currentCommandResponse_, currentCommand_]];
} else {
[self abortWithErrorMessage:[NSString stringWithFormat:@"Error: %@.\n\nInfo:\n%@", currentCommandResponse_, currentCommand_]];
}
return;
}
} else {
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