fix: use shell=True on Windows for npx.cmd
This commit is contained in:
1 parent
c69358c317
commit
4656203e4d
1 file changed
+18
-15
+18
-15
@@ -35,22 +35,25 @@ def start_backend():
|
||||
env['PORT'] = '3000'
|
||||
env['SKIP_PLC'] = '1'
|
||||
|
||||
# Use npx to run tsx, regardless of OS
|
||||
cmd = ['npx', 'tsx', 'src/index.ts']
|
||||
|
||||
# Windows: hide console window
|
||||
extra = {}
|
||||
if sys.platform == 'win32':
|
||||
extra['creationflags'] = 0x08000000 # CREATE_NO_WINDOW
|
||||
|
||||
backend = subprocess.Popen(
|
||||
cmd,
|
||||
cwd=str(PROJECT_DIR),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=env,
|
||||
**extra,
|
||||
)
|
||||
# Windows: npx.cmd needs shell=True; hide console
|
||||
backend = subprocess.Popen(
|
||||
'npx tsx src/index.ts',
|
||||
cwd=str(PROJECT_DIR),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=env,
|
||||
shell=True,
|
||||
creationflags=0x08000000,
|
||||
)
|
||||
else:
|
||||
backend = subprocess.Popen(
|
||||
['npx', 'tsx', 'src/index.ts'],
|
||||
cwd=str(PROJECT_DIR),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env=env,
|
||||
)
|
||||
|
||||
# Read stdout/stderr in background for log window
|
||||
def read_stream(stream, prefix=''):
|
||||
|
||||
Reference in new issue
Block a user