<discocaml>
<christopherfujino> Printf.printf "about to await %d...\n%!" tr_pid;
<discocaml>
<christopherfujino> let i, _ = Unix.waitpid [] tr_pid in
<discocaml>
<christopherfujino> Printf.printf "%d\n" i
<discocaml>
<christopherfujino> ```
<discocaml>
<christopherfujino>
<discocaml>
<christopherfujino> This code hangs forever at `Unix.waitpid [] tr_pid`, apparently because my `tr` command never exits (`uname` does however). Here is (a subset of) the contents of `ps aux` while my program is hanging:
<discocaml>
<christopherfujino>
<discocaml>
<christopherfujino> My C version is looks almost the same, with calls to `pipe()`, `fork()`, `dup2()`, and `execvp()`
<discocaml>
<christopherfujino> This question is probably more due to my weak unix understanding...although I can get this to work in C...
<discocaml>
<christopherfujino>
<discocaml>
<christopherfujino> ```ocaml
<discocaml>
<christopherfujino> let () =
<discocaml>
<christopherfujino> let read, write = Unix.pipe () in
<discocaml>
<christopherfujino> let uname_pid = match Unix.fork () with
<discocaml>
<christopherfujino> Printf.printf "about to await %d...\n%!" tr_pid;
<discocaml>
<christopherfujino> let i, _ = Unix.waitpid [] tr_pid in
<discocaml>
<christopherfujino> Printf.printf "%d\n" i
<discocaml>
<christopherfujino> ```
<discocaml>
<christopherfujino>
<discocaml>
<christopherfujino> This is running on Linux; this code hangs forever at `Unix.waitpid [] tr_pid`, apparently because my `tr` command never exits (`uname` does however). Here is (a subset of) the contents of `ps aux` while my program is hanging:
<discocaml>
<christopherfujino>
<discocaml>
<christopherfujino> My C version is looks almost the same, with calls to pipe(), fork(), dup2(), and execvp()
marijanp has left #ocaml [Error from remote client]
cr1901_ has quit [Read error: Connection reset by peer]
xvilka has quit [Server closed connection]
xvilka has joined #ocaml
bartholin has joined #ocaml
marijanp has joined #ocaml
cr1901 has joined #ocaml
hannes has quit [Ping timeout: 260 seconds]
Haudegen has joined #ocaml
euphores has quit [Quit: Leaving.]
euphores has joined #ocaml
eilvelia has quit [Read error: Connection reset by peer]
eilvelia has joined #ocaml
itszor has quit [Read error: Connection reset by peer]
priime has joined #ocaml
zor has joined #ocaml
priime has quit [Read error: Connection reset by peer]
priime has joined #ocaml
priime has quit [Remote host closed the connection]
<humasect>
i had spoken with Ahrefs before, great people. had a medical emergency i couldnt compelte the final task of interview =(
<discocaml>
<christopherfujino> Ok nvm, figured it out. the semantics in my C program were a little different, there I closed the write end of the pipe BEFORE forking the second process. not sure why that would make a difference, but it works now.
Haudegen has quit [Quit: Bin weg.]
<discocaml>
<christopherfujino> maybe if you don't close the FD before the second fork, then the second child process will have the other end of its own pipe open, and thus the pipe never closes?
<humasect>
a
Tuplanolla has joined #ocaml
Anarchos has joined #ocaml
shwouchk has quit [Remote host closed the connection]
shwouchk has joined #ocaml
Haudegen has joined #ocaml
Humean has quit [Quit: Leaving]
b0o has quit [Server closed connection]
b0o has joined #ocaml
myrkraverk has joined #ocaml
ripsquid has quit [Ping timeout: 272 seconds]
humasect has quit [Remote host closed the connection]
humasect has joined #ocaml
ripsquid has joined #ocaml
ursa-major has quit [Server closed connection]
ursa-major has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
seeg has quit [Server closed connection]
seeg has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 260 seconds]
greenonions has joined #ocaml
Mister_Magister has quit [Ping timeout: 255 seconds]
Mister_Magister has joined #ocaml
Ankhers has quit [Server closed connection]
humasect has quit [Quit: Leaving...]
Ankhers has joined #ocaml
Mister_Magister_ has joined #ocaml
Mister_Magister has quit [Ping timeout: 252 seconds]
Mister_Magister_ is now known as Mister_Magister
Mister_Magister_ has joined #ocaml
Mister_Magister has quit [Ping timeout: 255 seconds]
euphores has quit [Ping timeout: 252 seconds]
wingsorc has joined #ocaml
Mister_Magister has joined #ocaml
Mister_Magister_ has quit [Ping timeout: 248 seconds]
euphores has joined #ocaml
Mister_Magister has quit [Remote host closed the connection]