1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 22:06:38 +02:00

exec: display command return code after output (stdout/stderr)

This commit is contained in:
Sebastien Helleu
2014-03-11 09:52:08 +01:00
parent 9355c867ed
commit ee2cb329f4
+11 -9
View File
@@ -243,29 +243,31 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
ptr_buffer = weechat_buffer_search (exec_cmd->buffer_plugin,
exec_cmd->buffer_name);
/* display stdout/stderr (if output to buffer, the buffer must exist) */
exec_command_display_output (exec_cmd, ptr_buffer, 1);
exec_command_display_output (exec_cmd, ptr_buffer, 0);
/* display return code (only if output is NOT sent to buffer) */
if (!exec_cmd->output_to_buffer)
{
if (return_code >= 0)
{
weechat_printf_tags (ptr_buffer, "exec_rc",
"%s: end of command \"%s\" (rc=%d)",
EXEC_PLUGIN_NAME, exec_cmd->command,
return_code);
_("%s: end of command %d (\"%s\"), "
"return code: %d"),
EXEC_PLUGIN_NAME, exec_cmd->number,
exec_cmd->command, return_code);
}
else
{
weechat_printf_tags (ptr_buffer, "exec_rc",
_("%s%s: unexpected end of command \"%s\""),
_("%s%s: unexpected end of command %d "
"(\"%s\")"),
weechat_prefix ("error"), EXEC_PLUGIN_NAME,
exec_cmd->command);
exec_cmd->number, exec_cmd->command);
}
}
/* display stdout/stderr (if output to buffer, the buffer must exist) */
exec_command_display_output (exec_cmd, ptr_buffer, 1);
exec_command_display_output (exec_cmd, ptr_buffer, 0);
/* (re)set some variables after the end of command */
exec_cmd->hook = NULL;
exec_cmd->pid = 0;