api: add option "buffer_flush" in function hook_process_hashtable

v2.8-utf8proc
Sébastien Helleu 2014-04-03 11:39:23 +02:00
parent 6bf64e979d
commit 936d5559f4
7 changed files with 52 additions and 1 deletions

View File

@ -70,6 +70,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* core: add signals "key_combo_{default|search|cursor}"
* core: display a warning in case of inconsistency between the options
weechat.look.save_{config|layout}_on_exit
* api: add option "buffer_flush" in function hook_process_hashtable
* api: allow negative value for y in function printf_y
* api: add support of case insensitive search and search by buffer full name
in function buffer_search (bug #34318)

View File

@ -7214,6 +7214,12 @@ available:
Create a pipe for writing data on standard input (stdin) of child process
(see function <<_weechat_hook_set,weechat_hook_set>>)
| buffer_flush +
_(WeeChat ≥ 0.4.4)_ |
number of bytes |
Minimum number of bytes to flush stdout/stderr (to send output to callback),
between 1 and 65536 (default); 1 = send any output immediately to the callback
| detached +
_(WeeChat ≥ 0.4.4)_ |
(not used) |

View File

@ -7339,6 +7339,13 @@ sont disponibles :
Créer un tuyau pour écrire sur l'entrée standard (stdin) du processus fils
(voir la fonction <<_weechat_hook_set,weechat_hook_set>>)
| buffer_flush +
_(WeeChat ≥ 0.4.4)_ |
nombre d'octets |
Nombre minimum d'octets pour vider stdout/stderr (pour envoyer la sortie au
"callback"), entre 1 et 65536 (par défaut); 1 = envoyer toute sortie
immédiatement au "callback"
| detached +
_(WeeChat ≥ 0.4.4)_ |
(non utilisée) |

View File

@ -7333,6 +7333,13 @@ available:
Create a pipe for writing data on standard input (stdin) of child process
(see function <<_weechat_hook_set,weechat_hook_set>>)
// TRANSLATION MISSING
| buffer_flush +
_(WeeChat ≥ 0.4.4)_ |
number of bytes |
Minimum number of bytes to flush stdout/stderr (to send output to callback),
between 1 and 65536 (default); 1 = send any output immediately to the callback
// TRANSLATION MISSING
| detached +
_(WeeChat ≥ 0.4.4)_ |

View File

@ -7208,6 +7208,13 @@ struct t_hook *weechat_hook_process_hashtable (const char *command,
データを書き込むためのパイプを子プロセスの標準入力 (stdin)
に作成します (関数 <<_weechat_hook_set,weechat_hook_set>> を参照)
// TRANSLATION MISSING
| buffer_flush +
_(WeeChat バージョン 0.4.4 以上で利用可)_ |
number of bytes |
Minimum number of bytes to flush stdout/stderr (to send output to callback),
between 1 and 65536 (default); 1 = send any output immediately to the callback
| detached +
_(WeeChat バージョン 0.4.4 以上で利用可)_ |
(非使用) |

View File

@ -1351,7 +1351,9 @@ hook_process_hashtable (struct t_weechat_plugin *plugin,
{
struct t_hook *new_hook;
struct t_hook_process *new_hook_process;
char *stdout_buffer, *stderr_buffer;
char *stdout_buffer, *stderr_buffer, *error;
const char *ptr_value;
long number;
stdout_buffer = NULL;
stderr_buffer = NULL;
@ -1404,6 +1406,20 @@ hook_process_hashtable (struct t_weechat_plugin *plugin,
new_hook_process->buffer_size[HOOK_PROCESS_STDIN] = 0;
new_hook_process->buffer_size[HOOK_PROCESS_STDOUT] = 0;
new_hook_process->buffer_size[HOOK_PROCESS_STDERR] = 0;
new_hook_process->buffer_flush = HOOK_PROCESS_BUFFER_SIZE;
if (options)
{
ptr_value = hashtable_get (options, "buffer_flush");
if (ptr_value && ptr_value[0])
{
number = strtol (ptr_value, &error, 10);
if (error && !error[0]
&& (number >= 1) && (number <= HOOK_PROCESS_BUFFER_SIZE))
{
new_hook_process->buffer_flush = (int)number;
}
}
}
hook_add_to_list (new_hook);
@ -1668,6 +1684,12 @@ hook_process_child_read (struct t_hook *hook_process, int fd,
{
hook_process_add_to_buffer (hook_process, index_buffer,
buffer, num_read);
if (HOOK_PROCESS(hook_process, buffer_size[index_buffer]) >=
HOOK_PROCESS(hook_process, buffer_flush))
{
hook_process_send_buffers (hook_process,
WEECHAT_HOOK_PROCESS_RUNNING);
}
}
else if (num_read == 0)
{

View File

@ -222,6 +222,7 @@ struct t_hook_process
struct t_hook *hook_timer; /* timer to check if child has died */
char *buffer[3]; /* buffers for child stdin/out/err */
int buffer_size[3]; /* size of child stdin/out/err */
int buffer_flush; /* bytes to flush output buffers */
};
/* hook connect */