code wiki / _hdl_build / nx_wd_toy_liar.nx

nx_wd_toy_liar.nx source

↩ module page · 19 lines · 679 B

1// nx_wd_toy_liar.nx -- gate fixture for the work dispatcher: the FAKE-GREEN 2// class. Exits 0 (a liar's exit code) but its marker line says RED -- the 3// dispatcher must NOT report GREEN, because judgment is reconcile's MARK 4// evaluation, never the run exit. This is the $?-fake-green lesson as a 5// permanent fixture. 6// license_tier: ORIGINAL 7import "nx_syscalls.nx" 8 9func main() -> i64 { 10 let fd: i64 = sys_openat_append("/tmp/_wd_toy.log" as *u8, 0x1a4) 11 if fd < 0 { sys_exit(3) } 12 let s: *u8 = "WDTOYLIAR verdict=RED\n" as *u8 13 var n: i64 = 0 14 while s[n] != (0 as u8) { n = n + 1 } 15 sys_write(fd, s, n) 16 sys_close(fd) 17 sys_exit(0) 18 return 0 19}