2019 day 6 and 7

This commit is contained in:
2024-08-03 16:31:06 -04:00
parent 9718165d7b
commit 6f71ed1717
5 changed files with 209 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ import sys
def get_file_hash(filename):
hasher = hashlib.sha256()
with open(filename, 'rb') as f:
with open(filename, "rb") as f:
hasher.update(f.read())
return hasher.hexdigest()
@@ -25,7 +25,7 @@ def main(script_name, interval=1):
if process and process.poll() is None:
process.terminate()
print(f"Detected change in {script_name}, running script...")
process = subprocess.Popen(['pypy3', script_name], shell=False)
process = subprocess.Popen(["pypy3", script_name], shell=False)
time.sleep(interval)
except KeyboardInterrupt:
if process:
@@ -35,5 +35,6 @@ def main(script_name, interval=1):
print("The file was not found. Make sure the script name is correct.")
break
if __name__ == "__main__":
main(sys.argv[1])