On Jun 13, 10:41 am, Dan Stromberg <[EMAIL PROTECTED]> wrote: > I wrote a script(1) replacement in python (http://stromberg.dnsalias.org/ > ~dstromberg/pypty/), but I'm encountering a problem in it. > > I think I know the solution to the problem, but I'd've thought python was > high level enough that this solution isn't required, so I wanted to > inquire about it here. > > Specifically, the program has a signal handler for window size changes. > And if the window is resized during an os.write() (for example), I get a > python exception about needing to restart the system call. > > In C, I know you're supposed to wrap your system calls with while loops > until you don't get an ERESTART, but does one really need to wrap all of > one's os.write()'s (for example) with such while loops in python?
Unfortunately, signals are sometimes used to intentionally interrupt system calls, so we can't always loop on ERESTART. However, os.write() is a low level API. Maybe file.write() or socket.send() would be a little more robust? -- http://mail.python.org/mailman/listinfo/python-list