On Friday 05 October 2001 15:44, Jean-Marc Lasgouttes wrote: > >>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> On Friday 05 October 2001 15:14, Jean-Marc Lasgouttes wrote: > >> >>>>> "Jules" == Jules Bean <[EMAIL PROTECTED]> writes: > >> > >> >> It does not crash, it hangs... > >> > Jules> I'd still call it a bug. LyX should fork() before doing > Jules> something like that... > >> I guess the problem is the same with the converters code (if we > >> have a bogus converter). However, the converters are forced to wait > >> for completion before doing the next step. So how do we do that? > > Angus> You can pass a pointer to a function to Systemcalls. This > Angus> function is called on completion of the forked process. Why not > Angus> split the conversion code into two and place the "after > Angus> conversion" stuff in this function? > > So, if the converter hangs, LyX hangs waiting for completion, no?
That's not my understanding of the syscall.h comments: /// Uses fork() and execvp() DontWait }; /// Callback function gets commandline and return value from child typedef void (*Callbackfct)(string cmd, int retval); /// Systemcalls(); /** Generate instance and start child process. The string "what" contains a commandline with arguments separated by spaces. When the requested program finishes, the callback-function is called with the commandline and the return value from the program. The instance is automatically added to a timer check if starttype is DontWait (i.e. background execution). When a background child finishes, the timer check will automatically call the callback function. */ Systemcalls(Starttype how, string const & what, Callbackfct call = 0); Would not this do as you desire: Systemcalls::Callbackfct convert_callback = &convert_continue; Systemcalls convert(Systemcalls::DontWait, "convert file.eps XPM::file.xpm", convert_callback); // continue main LyX loop ... void convert_continue(string cmd, int retval) { // Ok, we have the file, now deal with it... }