diff options
Diffstat (limited to 'src/extern/stdio.nim')
-rw-r--r-- | src/extern/stdio.nim | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/extern/stdio.nim b/src/extern/stdio.nim deleted file mode 100644 index 729b50f6..00000000 --- a/src/extern/stdio.nim +++ /dev/null @@ -1,25 +0,0 @@ -import std/posix - -proc closeHandle(fd, flags: cint) = - let devnull = open("/dev/null", flags) - doAssert devnull != -1 - if devnull != fd: - discard dup2(devnull, fd) - discard close(devnull) - -proc closeStdin*() = - closeHandle(0, O_RDONLY) - -proc closeStdout*() = - closeHandle(1, O_WRONLY) - -proc closeStderr*() = - closeHandle(2, O_WRONLY) - -proc safeClose*(fd: cint) = - if fd == 0: - closeStdin() - elif fd == 1 or fd == 2: - closeHandle(fd, O_WRONLY) - else: - discard close(fd) |