Skip to content

Instantly share code, notes, and snippets.

@ilosamart
Last active March 7, 2024 20:17
Show Gist options
  • Save ilosamart/6a30036c82892f024242154ea5abc144 to your computer and use it in GitHub Desktop.
Save ilosamart/6a30036c82892f024242154ea5abc144 to your computer and use it in GitHub Desktop.
eternal.py
import subprocess
from threading import Timer
# main, but I'm lazy
with subprocess.Popen(['bash', 'eternal.sh'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8') as proc:
try:
timer = Timer(5, proc.kill)
timer.start()
for line in proc.stdout:
print(f'>> {line.strip()}')
print('Deu.')
finally:
timer.cancel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment