mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 18:36:30 +00:00
fix(channel): fix channel consistency
- Fix the problem that chanclose() does not work for channel created by nvim_open_term(). - Fix the problem that the loopback channel is not released. - Fix the error message when sending raw data to the loopback channel.
This commit is contained in:
@@ -317,10 +317,14 @@ void terminal_close(Terminal *term, int status)
|
||||
term->opts.close_cb(term->opts.data);
|
||||
}
|
||||
} else if (!only_destroy) {
|
||||
// This was called by channel_process_exit_cb() not in process_teardown().
|
||||
// Associated channel has been closed and the editor is not exiting.
|
||||
// Do not call the close callback now. Wait for the user to press a key.
|
||||
char msg[sizeof("\r\n[Process exited ]") + NUMBUFLEN];
|
||||
snprintf(msg, sizeof msg, "\r\n[Process exited %d]", status);
|
||||
if (((Channel *)term->opts.data)->streamtype == kChannelStreamInternal) {
|
||||
snprintf(msg, sizeof msg, "\r\n[Terminal closed]");
|
||||
} else {
|
||||
snprintf(msg, sizeof msg, "\r\n[Process exited %d]", status);
|
||||
}
|
||||
terminal_receive(term, msg, strlen(msg));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user