thraxil.org:

Reply to: Subprocess Hanging: PIPE is your enemy

What about deadlocks when invoking a shell script which itself forks a child process? From the real shell, it returns right away as expected; but, from Subprocess, it deadlocks until the child process dies. Before you ask, data output does NOT exceed 64K. :)

Thanks.

It's kind of a different issue entirely, but basically, don't do that.

One of my pet peeves is command line apps or scripts that background themselves and don't have a "foreground" mode. I consider that a major unix faux pas. So if you're writing the shell script that you're calling, just don't do it. If you didn't write it, can you fix it and add a foreground mode? If, for some reason you can't fix it, you're going to be stuck with some kind of ugly workaround, probably involving pidof.

I've seen more of the command line apps that background themselves without a foreground mode cropping up lately, particularly on OS X. I suspect that it's programmers who are used to writing GUI apps and making polished "user friendly" interfaces who have been asked to put a command line frontend on their application. The command takes a long time to run and, coming from a GUI background, they think "the user shouldn't have to wait around while it works, let's do it in the background". Good instinct for a GUI app. Annoying as hell for a command line application as all it really does it make it hard to put in a script.


formatting is with Markdown syntax. Comments are not displayed until they are approved by a moderator. Moderators will not approve unless the comment contributes value to the discussion.

namerequired
emailrequired
url
remember info?