File size: 492 Bytes
f465388
 
6b314b0
f465388
 
6b314b0
f465388
 
 
 
 
 
6a646db
f465388
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import subprocess
import os

# Define the command to run
command = ['node', 'api.js']

# Open a file for logging
with open('log.txt', 'w') as log_file:
    # Spawn the process
    process = subprocess.Popen(command, cwd="./mmapi", stdout=log_file, stderr=subprocess.STDOUT, 
                               stdin=subprocess.DEVNULL, close_fds=True, 
                               start_new_session=True)

# The Python script ends here, but the Node process continues to run in the background