ref: c0b8e8f30ce98acc52a8268dbb13744950d636e3
parent: 0f959a0c6f79986cc32d8456b503957476bdae83
author: Ori Bernstein <[email protected]>
date: Sun Jun 24 11:56:40 EDT 2018
Remove filterfd. Neat party trick, but not generally useful enough to belong in libstd.
--- a/lib/std/spork.myr
+++ b/lib/std/spork.myr
@@ -12,7 +12,6 @@
const espork : (cmd : byte[:][:] -> result((pid, fd, fd, fd), errno))
const sporkdir : (cmd : byte[:][:], dir : byte[:] -> result((pid, fd, fd), errno))
const esporkdir : (cmd : byte[:][:], dir : byte[:] -> result((pid, fd, fd, fd), errno))
- const filterfd : (fd : fd, cmd : byte[:][:] -> result(pid, errno))
;;
const run = {cmd
@@ -115,26 +114,6 @@
close(errfds[0])
close(errfds[1])
-> `Err err
-}
-
-const filterfd = {fd, cmd
- var outfds : fd[2]
- var err
-
- err = pipe(&outfds)
- if err != Enone
- -> `Err err
- ;;
-
- match sporkfd(cmd, "", [fd, -1], outfds, [-1, 2])
- | `Ok pid:
- dup2(outfds[0], fd)
- close(outfds[0]);
- close(outfds[1]);
- -> `Ok pid
- | `Err e:
- -> `Err e
- ;;
}
const sporkfd = {cmd, dir, infds, outfds, errfds