Spaces:
Running
Running
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 | |