process: Pass loop reference during initialization

Change the API so that it is passed to {uv,pty}_process_init instead of
`process_spawn`.
This commit is contained in:
Thiago de Arruda
2015-07-24 11:56:44 -03:00
parent 3f5af6c1c4
commit 696f9c2759
7 changed files with 18 additions and 19 deletions

View File

@@ -123,14 +123,14 @@ void channel_teardown(void)
uint64_t channel_from_process(char **argv)
{
Channel *channel = register_channel(kChannelTypeProc);
channel->data.process.uvproc = uv_process_init(channel);
channel->data.process.uvproc = uv_process_init(&loop, channel);
Process *proc = &channel->data.process.uvproc.process;
proc->argv = argv;
proc->in = &channel->data.process.in;
proc->out = &channel->data.process.out;
proc->err = &channel->data.process.err;
proc->cb = process_exit;
if (!process_spawn(&loop, proc)) {
if (!process_spawn(proc)) {
loop_poll_events(&loop, 0);
decref(channel);
return 0;