Remove subprocess dependency and register atexit for children processes

* subprocess has some bugs and is not so reliable as we've thought.
* signal handling does not work as we expected for children, that's
why the `atexit.register`.