mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
* posix_other: Haiku now has spawn.h This is added per https://dev.haiku-os.org/ticket/13446 * posix_other: Add Haiku specific Dirent members * cpuinfo: Add an implementation for Haiku * distros: Add basic Haiku support * encodings: update Haiku support * fenv, math: Haiku now provides libm * times: Add Haiku struct members * ansi_c, osalloc: Add Haiku constants * threads: Add Haiku support * testament: Haiku uses LIBRARY_PATH * nim.cfg: Update Haiku support libnetwork should only be linked if network functions are used * threads: Haiku does not support -pthread switch * tworkingdir: Haiku's env is in /bin * posix_other: add SIGKILLTHR for Haiku * sockets: link with libnetwork on Haiku * coro: correct ucontext.h location http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html * coro: ucontext backend is not available on Haiku Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX * coro: fix setjmp backend The compiler does not allow statements after a noreturn function * nativesockets: Haiku doesn't support AI_V4MAPPED * system: hostOS can contains "haiku" * os: add support for Haiku's packagefs packagefs is read-only, but there are writable holes to the underlying file system as well * os: update constant for Haiku
40 lines
882 B
Nim
40 lines
882 B
Nim
discard """
|
|
output: '''true
|
|
true'''
|
|
targets: "c"
|
|
"""
|
|
|
|
import os, osproc
|
|
when not defined(windows):
|
|
import posix
|
|
|
|
# Checks that the environment is passed correctly in startProcess
|
|
# To do that launches a copy of itself with a new environment.
|
|
|
|
if paramCount() == 0:
|
|
# Parent process
|
|
|
|
let p = startProcess(
|
|
getAppFilename(),
|
|
args = @["child"],
|
|
options = {poStdErrToStdOut, poUsePath, poParentStreams}
|
|
)
|
|
|
|
echo p.running()
|
|
|
|
p.kill()
|
|
|
|
when defined(windows):
|
|
# windows kill happens using TerminateProcess(h, 0), so we should get a
|
|
# 0 here
|
|
echo p.waitForExit() == 0
|
|
elif defined(haiku):
|
|
# on Haiku, the program main thread receive SIGKILLTHR
|
|
echo p.waitForExit() == 128 + SIGKILLTHR
|
|
else:
|
|
# on posix (non-windows), kill sends SIGKILL
|
|
echo p.waitForExit() == 128 + SIGKILL
|
|
|
|
else:
|
|
sleep(5000) # should get killed before this
|