-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
32 lines (26 loc) · 1.11 KB
/
run.py
File metadata and controls
32 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import subprocess
import os
import time
# Fonction pour exécuter une commande dans un dossier donné et attendre qu'elle démarre
def run_command(command, cwd=None):
process = subprocess.Popen(command, shell=True, cwd=cwd)
return process
# Chemins
root = os.getcwd()
system_scripts = os.path.join(root, 'SystemScripts')
macro_controller = os.path.join(system_scripts, 'macro-controller')
# Étape 1 : npm run prod
print("🔧 Démarrage de npm run prod...")
npm_process = run_command('npm run prod')
time.sleep(5) # Optionnel : attendre un peu que le serveur démarre
# Étape 2 : server.js
print("🟢 Démarrage de server.js...")
server_process = run_command('node server.js', macro_controller)
time.sleep(3)
# Étape 3 : key_listener.py
print("🎧 Démarrage de key_listener.py...")
key_listener_process = run_command('python key_listener.py', system_scripts)
# Étape 4 : controller_cursor.py et controller_input.py
print("🖱️ Démarrage des contrôleurs...")
cursor_process = run_command('python controller_cursor.py', macro_controller)
input_process = run_command('python controller_input.py', macro_controller)