subprocess: add a callback to ignore output

This callback is equivalent to shoving data into /dev/null.
This commit is contained in:
Ben Boeckel 2016-07-02 07:51:56 -04:00 committed by wm4
parent 6a3da439cd
commit 33e72ed451
2 changed files with 6 additions and 0 deletions

View File

@ -45,6 +45,10 @@ static void *run_subprocess(void *ptr)
return NULL;
}
void mp_devnull(void *ctx, char *data, size_t size)
{
}
void mp_subprocess_detached(struct mp_log *log, char **args)
{
struct subprocess_args *p = talloc_zero(NULL, struct subprocess_args);

View File

@ -24,6 +24,8 @@ struct mp_cancel;
typedef void (*subprocess_read_cb)(void *ctx, char *data, size_t size);
void mp_devnull(void *ctx, char *data, size_t size);
// Start a subprocess. Uses callbacks to read from stdout and stderr.
int mp_subprocess(char **args, struct mp_cancel *cancel, void *ctx,
subprocess_read_cb on_stdout, subprocess_read_cb on_stderr,