26 lines
728 B
Python
26 lines
728 B
Python
|
import subprocess
|
||
|
import time
|
||
|
|
||
|
# Define the commands to run in each bash instance
|
||
|
command1 = "python3 app.py"
|
||
|
command2 = "npx tailwindcss -i ./src/input.css -o ./static/output.css --watch"
|
||
|
|
||
|
# Start the first bash process
|
||
|
process1 = subprocess.Popen(command1, shell=True, executable='/bin/bash')
|
||
|
|
||
|
# Start the second bash process
|
||
|
process2 = subprocess.Popen(command2, shell=True, executable='/bin/bash')
|
||
|
|
||
|
try:
|
||
|
# Keep the script running indefinitely
|
||
|
while True:
|
||
|
time.sleep(1)
|
||
|
except KeyboardInterrupt:
|
||
|
# If the script is interrupted (e.g., Ctrl+C), terminate both processes
|
||
|
process1.terminate()
|
||
|
process2.terminate()
|
||
|
process1.wait()
|
||
|
process2.wait()
|
||
|
|
||
|
print("Both processes have been terminated.")
|