Last active
March 7, 2024 20:17
-
-
Save ilosamart/6a30036c82892f024242154ea5abc144 to your computer and use it in GitHub Desktop.
eternal.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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