fork()/exec()/waitpid() error handling in Grip
Mikko Rapeli <[email protected]>
| Newsgroups | gmane.comp.multimedia.grip.user |
|---|---|
| Message-ID | <20050117141211.GA24380@nalle> |
Hi, Recently Debian unstable had a problem with the libFLAC library so oggenc didn't work at all: $ oggenc oggenc: error while loading shared libraries: libFLAC.so.6: cannot open shared object file: No such file or directory $ echo $? 127 I was using Grip to convert a couple of CD to .ogg at that time and everything seemed to work: Grip ripped the .wav's and supposedly encoded them too. Of course the .ogg's were missing due to this FLAC issue, but Grip showed no error signs even though oggenc returned an error and even the Status tab showed nothing about the error. The attached patch to grip-3.2.0 from Debian unstable works better when the encoder fails but it totally sucks in normal succesfull case - there must be better ways of doing this. I think there should be a generic way of checking how spawned processes exit'ed in Grip: - Perhaps every fork/exec should be followed by a waitpid() to check that the return value is ok, but that make's the UI sluggish as the main process is blocking all the time. - A sigaction() approach seems more complicated if every spawned process needs to be tracked, but perhaps it could be used to track all spawned processes as a bunch and for example cancel the encoding if any of the encoding processes fail. I think Grip should tell the user if for example disk fills up during encoding or ripping, at least in the Status tab. What do you think? I'm no *nix programming expert, but I could perhaps scratch my itch :) -Mikko ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt