Subprocess kills parent process instantly

82 views Asked by At

When I try to run mkdocs serve as a subprocess and use CTRL+C to quit the MkDocs server, the parent Python process quits instantly, too. Not even finally clauses or functions registered with atexit are called.

try:
  os.system('mkdocs serve')
finally:
  print('>> finally')

What the heck is going on? I can't find anything suspicious after looking at the implementation of the mkdocs serve command. Tested with Python 3.4 on Windows.


Update: Turns out this seems to be an issue with Mintty (GitForWindows) on Windows. Everything works fine if I run the Python script from Cmder or the native Windows command prompt..

0

There are 0 answers