Sha256: a8d405a573148bab90bd98848b1793cc2857a461cec9c19afe3346c8db0b832f

Contents?: true

Size: 651 Bytes

Versions: 15

Compression:

Stored size: 651 Bytes

Contents

#include <stdio.h>

#include <uv.h>

uv_loop_t *loop;
uv_process_t child_req;
uv_process_options_t options;

int main() {
    loop = uv_default_loop();

    char* args[3];
    args[0] = "sleep";
    args[1] = "100";
    args[2] = NULL;

    options.exit_cb = NULL;
    options.file = "sleep";
    options.args = args;
    options.flags = UV_PROCESS_DETACHED;

    int r;
    if ((r = uv_spawn(loop, &child_req, &options))) {
        fprintf(stderr, "%s\n", uv_strerror(r));
        return 1;
    }
    fprintf(stderr, "Launched sleep with PID %d\n", child_req.pid);
    uv_unref((uv_handle_t*) &child_req);

    return uv_run(loop, UV_RUN_DEFAULT);
}

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
mt-libuv-4.1.04 ext/libuv/docs/code/detach/main.c
mt-libuv-4.1.03 ext/libuv/docs/code/detach/main.c
mt-libuv-4.1.02 ext/libuv/docs/code/detach/main.c
libuv-4.0.9 ext/libuv/docs/code/detach/main.c
libuv-4.0.2 ext/libuv/docs/code/detach/main.c
libuv-4.0.1 ext/libuv/docs/code/detach/main.c
libuv-4.0.0 ext/libuv/docs/code/detach/main.c
libuv-3.3.0 ext/libuv/docs/code/detach/main.c
libuv-3.2.4 ext/libuv/docs/code/detach/main.c
libuv-3.2.3 ext/libuv/docs/code/detach/main.c
libuv-3.2.2 ext/libuv/docs/code/detach/main.c
libuv-3.2.1 ext/libuv/docs/code/detach/main.c
libuv-3.2.0 ext/libuv/docs/code/detach/main.c
libuv-3.1.9 ext/libuv/docs/code/detach/main.c
libuv-3.1.8 ext/libuv/docs/code/detach/main.c