Skip to content

Commit

Permalink
0818
Browse files Browse the repository at this point in the history
  • Loading branch information
tian50 committed Aug 18, 2021
1 parent 616afd8 commit 08c1382
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions msgpi/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import signal
import math
import subprocess as sbp
Expand All @@ -13,9 +14,11 @@ def run(cmd, timeout, scrnout):
# sbp.call(cmd)
proc = sbp.Popen(cmd)
else:
# FNULL = open(os.devnull, 'w')
# sbp.call(cmd, stdout=FNULL, stderr=sbp.STDOUT)
proc = sbp.Popen(cmd, stdout=sbp.DEVNULL, stderr=sbp.STDOUT,preexec_fn=os.setsid)
if platform.system() == 'Windows':
FNULL = open(os.devnull, 'w')
proc = sbp.Popen(cmd, stdout=FNULL, stderr=sbp.STDOUT)
elif platform.system() == 'Linux':
proc = sbp.Popen(cmd, stdout=sbp.DEVNULL, stderr=sbp.STDOUT,preexec_fn=os.setsid)

try:
stdout, stderr = proc.communicate(timeout=timeout)
Expand Down

0 comments on commit 08c1382

Please sign in to comment.