I want to write a little python script to automate Jekyll blog creation, but popen()
seems to block and not call asynchronously.
The expected behavior would be:
- Start
jekyll serve --livereload
asynchronously - Start
firefox-esr http://127.0.0.1:4000
async and wait for it(, or synchronously, this is not relevant in my use case) - After termination of firefox, terminate Jekyll too.
jekyll = subprocess.Popen(['jekyll', 'serve', '--livereload'])
print('This never gets displayed')
time.sleep(3)
firefox = subprocess.Popen(['firefox-esr', 'http://127.0.0.1:4000'])
firefox.wait()
jekyll.terminate()
But this only starts Jekyll and outputs its stdout to the terminal.
This problem only appears with Jekyll. ping
or any other command/program i tried work fine.
Any ideas on what I did wrong?