Javascript 如何启动额外的PM2

Javascript 如何启动额外的PM2,javascript,python,pm2,Javascript,Python,Pm2,所以我发现一个新的可能是一个bug或者我做错了什么 我创建了一个小脚本: pm2 start test.py >>> import subprocess import random import time print(f"hello {random.randint(1,500)}") subprocess.Popen(f'pm2 start test.py --name {random.randint(1,500)}', shell=True).com

所以我发现一个新的可能是一个bug或者我做错了什么

我创建了一个小脚本:

pm2 start test.py

>>>
import subprocess
import random
import time

print(f"hello {random.randint(1,500)}")

subprocess.Popen(f'pm2 start test.py --name {random.randint(1,500)}', shell=True).communicate()
time.sleep(3)
因此,基本上应该发生的是,当您运行pm2 start test.py时,它应该为test.py创建一个新的pm2脚本,但使用不同的名称,我添加为random

现在发生的情况是,如果您通过pm2运行Popen函数,它不会启动Popen函数,但是如果您运行py test.py,那么它就可以了,但是如果您从pm2 start test.py开始,那么它不会为test.py添加额外的新脚本,应该添加哪个逻辑脚本

我做错了什么

编辑:

如果我运行py test.py

随机导入
从子流程导入Popen、PIPE、STDOUT
导入时间
尽管如此:
变量=random.randint(1500)
打印(f“hello{variable}”)
Popen(f“where python”,shell=True,universal\u newlines=True)
时间。睡眠(3)
>>>你好49
>>>C:\Users\PC\AppData\Local\Programs\Python\Python38\Python.exe
>>>C:\Users\PC\AppData\Local\Microsoft\WindowsApps\python.exe
如果我运行pm2 start test.py,请执行相同的代码:

你好 >>>你好32 >>>你好41