robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

dundargoctest: format C test files and fix clang-tidy warningsfd05c7f19d

master
674 B31 linesraw
1/// Helper program to exit and keep stdout open (like "xclip -i -loops 1").
2#include <stdio.h>
3#include <uv.h>
4
5int main(int argc, char **argv)
6{
7  uv_loop_t *loop = uv_default_loop();
8  uv_process_t child_req;
9
10  char *args[3];
11  args[0] = "sleep";
12  args[1] = "10";
13  args[2] = NULL;
14
15  uv_process_options_t options = {
16    .exit_cb = NULL,
17    .file = "sleep",
18    .args = args,
19    .flags = UV_PROCESS_DETACHED,
20  };
21
22  int r;
23  if ((r = uv_spawn(loop, &child_req, &options))) {
24    fprintf(stderr, "%s\n", uv_strerror(r));
25    return 1;
26  }
27  fprintf(stderr, "pid: %d\n", child_req.pid);
28  uv_unref((uv_handle_t *)&child_req);
29
30  return uv_run(loop, UV_RUN_DEFAULT);
31}