Skip to content

os.popen leaving a zombie #13239

Discussion options

You must be logged in to vote

popen is calling fork which creates a child process. In order to avoid a zombie process, the parent process must wait on the child process. But since popen doesn't return the pid of the child, there is not currently a way to wait on the child process. So this looks like a bug in micropython-lib.

Should I open an issue do you think? Is it fixable? The zombies make the function pretty useless, for me at least.

I needed the output so I used:

STATUS = "/tmp/uhttpd.status"

def publish_https():
        e = os.system("service uhttpd status >" + STATUS)
        with open(STATUS, "r") as f:
                r = f.read().strip()
        os.remove(STATUS)

        if r == "running":
              …

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@peterhinch
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@dlech
Comment options

@protectivedad
Comment options

Answer selected by protectivedad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants