|
| 1 | +From 52a918c82bddeef58a842d112bcb42c6f33883ab Mon Sep 17 00:00:00 2001 |
| 2 | +From: =?UTF-8?q?Patrick=20B=C3=B6ker?= < [email protected]> |
| 3 | +Date: Mon, 22 Dec 2025 20:12:04 +0100 |
| 4 | +Subject: [PATCH] Fix building MoarVM with a system provided libuv |
| 5 | + |
| 6 | +--- |
| 7 | + src/io/procops.c | 17 ++++++++++++++--- |
| 8 | + 1 file changed, 14 insertions(+), 3 deletions(-) |
| 9 | + |
| 10 | +diff --git a/src/io/procops.c b/src/io/procops.c |
| 11 | +index de8dd90b4..71d04d20f 100644 |
| 12 | +--- a/src/io/procops.c |
| 13 | ++++ b/src/io/procops.c |
| 14 | +@@ -773,13 +773,17 @@ static MVMint64 get_pipe_fd(MVMThreadContext *tc, uv_pipe_t *pipe) { |
| 15 | + return 0; |
| 16 | + } |
| 17 | + static void spawn_setup(MVMThreadContext *tc, uv_loop_t *loop, MVMObject *async_task, void *data) { |
| 18 | +- MVMint64 spawn_result; |
| 19 | ++ MVMint64 spawn_result = 0; |
| 20 | + char *error_str = NULL; |
| 21 | + |
| 22 | + /* Process info setup. */ |
| 23 | + uv_process_t *process = MVM_calloc(1, sizeof(uv_process_t)); |
| 24 | ++#ifdef MVM_HAS_LIBUV_PTY |
| 25 | + uv_process_options2_t process_options = {0}; |
| 26 | + process_options.version = UV_PROCESS_OPTIONS_VERSION; |
| 27 | ++#else |
| 28 | ++ uv_process_options_t process_options = {0}; |
| 29 | ++#endif |
| 30 | + uv_stdio_container_t process_stdio[3]; |
| 31 | + |
| 32 | + #ifdef MVM_DO_PTY_OURSELF |
| 33 | +@@ -804,13 +808,13 @@ static void spawn_setup(MVMThreadContext *tc, uv_loop_t *loop, MVMObject *async_ |
| 34 | + goto spawn_setup_error; |
| 35 | + #endif |
| 36 | + |
| 37 | +- process_options.pty_cols = |
| 38 | ++ int cols = |
| 39 | + MVM_repr_exists_key(tc, si->callbacks, tc->instance->str_consts.pty_cols) |
| 40 | + ? MVM_repr_get_int(tc, MVM_repr_at_key_o(tc, |
| 41 | + si->callbacks, |
| 42 | + tc->instance->str_consts.pty_cols)) |
| 43 | + : 80; |
| 44 | +- process_options.pty_rows = |
| 45 | ++ int rows = |
| 46 | + MVM_repr_exists_key(tc, si->callbacks, tc->instance->str_consts.pty_rows) |
| 47 | + ? MVM_repr_get_int(tc, MVM_repr_at_key_o(tc, |
| 48 | + si->callbacks, |
| 49 | +@@ -818,6 +822,9 @@ static void spawn_setup(MVMThreadContext *tc, uv_loop_t *loop, MVMObject *async_ |
| 50 | + : 24; |
| 51 | + |
| 52 | + #ifdef MVM_HAS_LIBUV_PTY |
| 53 | ++ |
| 54 | ++ process_options.pty_cols = cols; |
| 55 | ++ process_options.pty_rows = rows; |
| 56 | + uv_pipe_t *pipe = MVM_malloc(sizeof(uv_pipe_t)); |
| 57 | + uv_pipe_init(loop, pipe, 0); |
| 58 | + pipe->data = si; |
| 59 | +@@ -995,7 +1002,11 @@ static void spawn_setup(MVMThreadContext *tc, uv_loop_t *loop, MVMObject *async_ |
| 60 | + |
| 61 | + /* Attach data, spawn, report any error. */ |
| 62 | + process->data = si; |
| 63 | ++#ifdef MVM_HAS_LIBUV_PTY |
| 64 | + spawn_result = uv_spawn2(loop, process, &process_options); |
| 65 | ++#else |
| 66 | ++ spawn_result = uv_spawn(loop, process, &process_options); |
| 67 | ++#endif |
| 68 | + |
| 69 | + #ifdef MVM_DO_PTY_OURSELF |
| 70 | + if (pty_mode) |
| 71 | +-- |
| 72 | +2.50.0 |
| 73 | + |
0 commit comments