: <i>Thread pool panics if stdin closed and IO performed in initcmd</i> plus 6 other changes
by
.
D 2025-02-22T13:17:02.464
J closedate 2460729.05350073
J closer sebres
J icomment It's\snot\sa\sbug,\sit's\sa\sdocumented\sfeature...\r\nIf\sthe\sstandard\schannels\sget\sclosed,\sthey\swill\sbe\sreopen\sby\snext\schannel\sopen\scommand\s(chan/file/pipe/socket/whatever).\s\r\nJust\sin\syour\scase\sthe\sunexpected\sthing\s-\syou\sdo\sthat\snot\sfrom\smain\sthread\s(and\sthe\schannel\sis\sopened\snot\sfor\sread)...\r\n\r\nSee\s[https://stackoverflow.com/a/68869664|https://stackoverflow.com/a/68869664]\sfor\smore\sdetailed\sanswer\sto\ssimilar\squestion.\r\n\r\nNo\sidea\swhat\sare\syou\strying\sto\sdo\sby\sclosing\sof\sstdin,\sbut\sif\sit\sis\ssomething\slike\ssignal\sto\scaller\sEOF,\syou\scan\ssimply\sreopen\snew\s(dummy)\sstdin\simplicitly\safter\s`close\sstdin`,\sfor\sinstance\swith\s`chan\spipe`\scommand.<br/>\r\nFor\sinstance,\strying\ssomething\slike\sthis\sin\stcl-shell,\syou'd\ssee\sthat\sread\sside\sof\spipe\schannels\sbecomes\s(new)\sstdin:\r\n<code><pre>\r\n\s\s\s\s%\sclose\sstdin;\sputs\s[chan\spipe]\r\n\s\s\s\sstdin\sfile3\r\n</pre></code>\r\nHereafter\severything\sshall\swork\sas\sexpected\swith\sthe\sthreads\s(and\sregistering\schannels\sdoesn't\sget\sconfused).\r\n\r\nBy\sthe\sway,\sthis\sis\sTcl-\snot\sthread-repository,\sso\sbasically\severy\sthread-related\sstuff\sbelongs\sto\s[../thread/|thread-repository].
J login sebres
J mimetype text/x-fossil-wiki
J resolution Invalid
J status Closed
K b78d94c049af5090a9ef1c4aaa8059aa45b98b59
U sebres
Z 4c2544ccf797bc72134cda3e898d1af0