File::startAsProcess() hanging


#1

I’m finding that File::startAsProcess() has a tendency to hang on linux. It doesn’t happen all the time, but when it does, the whole app hangs, and the app I’m trying to run doesn’t show until I force quit the hanging app.

For now I’ve got around it by using the following code (I think I got it from the windowlab source):

[code] pid_t pid = fork();

switch (pid)
{
	case 0: //Child process - successful.
		setsid();
		execlp("/bin/sh", "sh", "-c", (char*) (const char*) cmdString, NULL);
		//Only get to this point if execlp didn't work.
		exit(1);
		break;
	case -1: //Parent process - unsuccessful.
		return false;
		break;
	default: //Parent process - successful.
		break;
}[/code]

But I’m not sure if it’s a complete replacement for the current JUCE code…

  • Niall.

#2

hmm. There’s a lot more situations handled in the current juce code than this would cope with. I guess it must be hanging in the waitpid() call.

Can’t see anything that’s obviously wrong with the juce code, though you could try putting the setsid() call into it to see if that’s what’s needed?


#3

Nope, sorry, that doesn’t seem to fix it :(. Anything else I can try?

  • Niall.

#4

can’t think of anything… Can you catch it in the debugger and see exactly where it’s hanging?


#5

Okay, as far as I can tell (the debugger was acting up a bit), it does seem to be the waitpid call that’s causing the problem. Don’t know if that’s any help though.

  • Niall.

#6

hmm. I’m not much of an expert on linux process stuff. I’ll have a think…


#7