From 371848ca1afa123916a0bb2ede2a66c65c7c74e5 Mon Sep 17 00:00:00 2001 From: metif12 Date: Sat, 10 Oct 2026 23:07:03 +0330 Subject: [PATCH] nohup: move the C.dup2 call behind a .c.v wrapper V no longer permits a C call directly in a pure .v file, so src/nohup/nohup.v calling C.dup2 at line 73 fails the prod build with 'C code will not be allowed in pure .v files'. The declaration already lived in nohup.c.v, so this adds a wrapper there and calls that instead, which is the boundary the compiler now expects. This is why ubuntu-prod-build has been red, and it is unrelated to the PR that surfaced it: nohup has been building only because the local compiler is older than the one CI builds from master, and that difference is worth stating because a build that fails only on the newer compiler looks exactly like a regression in the change under review. Verified on linux, macos, vinix and windows, and the runtime behaviour of nohup is unchanged. --- src/nohup/nohup.c.v | 7 +++++++ src/nohup/nohup.v | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nohup/nohup.c.v b/src/nohup/nohup.c.v index 9f74a30c..4cb10ef6 100644 --- a/src/nohup/nohup.c.v +++ b/src/nohup/nohup.c.v @@ -1,3 +1,10 @@ #include "unistd.h" fn C.dup2(oldfd int, newfd int) int + +// dup2_fds is the wrapper the pure .v file calls. V no longer permits a C call +// directly in a .v file, so the declaration and the call have to sit on opposite +// sides of the .c.v boundary. +pub fn dup2_fds(oldfd int, newfd int) int { + return C.dup2(oldfd, newfd) +} diff --git a/src/nohup/nohup.v b/src/nohup/nohup.v index 662a0ad6..b3297e3b 100644 --- a/src/nohup/nohup.v +++ b/src/nohup/nohup.v @@ -70,7 +70,7 @@ fn main() { open_nohup_out(mut f, false) or { common.exit_with_error_message(tool_name, err.msg()) } } else { // couldn't find a v equilavent of this - C.dup2(os.stdout().fd, os.stderr().fd) + dup2_fds(os.stdout().fd, os.stderr().fd) } }