abe@mace.cc.purdue.edu (Vic Abell) (02/23/89)
I've been conducting some experiments with processes that are begun right after login by loginwindow and before the Workspace manger (they're started by using "dwrite loginwindow Workspace <program path>"). I've learned a trick about the standard I/O file descriptors that is worth passing on: processes launched from loginwindow have only a stdin, and neither a stdout nor a stderr. So, if your application is using a pipe to some other application - e. g., to /etc/disk - you can't use the usual pipe/dup2/close techniques, because you may accidentally close one of the pipe descriptors that you need. First you should open /dev/null and dup2 it to stdout and sterr, then use pipe, dup2 and close in their normal order.