Creates a subprocess in simpler safer manner. Clone of the official repo.