ref: 4bc888e7519352d1dd1f5e343a75e022ac224e1d
dir: /libstd/wait+posixy.myr/
use sys use "die.use" use "syswrap.use" pkg std = type waitstatus = union `Wsuccess `Wfailure `Wsignal `Waiterror ;; const wait : (pid : pid -> waitstatus) ;; const wait = {pid var st :again if sys.waitpid(pid castto(sys.pid), &st, 0) > 0 match sys.waitstatus(st) /* when a process stops, eg, if paused by a debugger, wait() will return. This API is for waiting until a process exits. Loop instead. */ | `sys.Waitstop sig: goto again | `sys.Waitsig sig: -> `Wsignal | `sys.Waitexit status: if status == 0 -> `Wsuccess else -> `Wfailure ;; ;; ;; -> `Waiterror }