close stdin & -out , then "exit" reads from pipe instead of exiting.
From
Andreas Leitgeb@21:1/5 to
All on Tue Dec 6 02:58:36 2022
Is there any special logic within tcl, when stdin & -out have
been closed? maybe, if next command is "exec" ?
I've got a tcl-script that gets started with stdin and stdout
connected to a socket.
Under some circumstances, these sockets get closed, and at that
point the script is only supposed to [exec ...] a (shortly
running) command, and then exit.
But instead, it keeps "hanging" after the exec.
Running it with "truss" shows closing of stdin & -out,
and immediately afterwards a pipe is created, and some
flag is set for them:
55572: 33847: close(0) = 0
55572: 33847: close(1) = 0
not sure if next 3 lines are aftermath of close, or part of [exec]
55572: 33847: pipe(0x2FF21FD8) = 0
55572: 33847: kfcntl(0, F_SETFD, 0x00000001) = 0
55572: 33847: kfcntl(1, F_SETFD, 0x00000001) = 0
... [exec ...]: kfork, childprocess does: ..., execve, ..., _exit(0)
and then the main process goes on to:
55572: 33847: kread(0, 0x205D2324, 4096) (sleeping...)
Reading from a pipe, whose write-side is kept by the same process.
I don't know where the read on stdin comes from. According to
the script it should do an "exit" right after the "exec".
So far, I cannot yet tell, if this is a "heisen-" or "bohr-" bug.
I see it happens a couple of times, but I don't get to see the
cases where it doesn't happen, if those exist.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)