yujuanqin commited on
Commit
cbe0c62
·
1 Parent(s): fa3606d

ignore subprocess stdout to fix subprocess stuck

Browse files
Files changed (1) hide show
  1. lib/app_runner.py +2 -7
lib/app_runner.py CHANGED
@@ -30,8 +30,8 @@ class AppRunner:
30
  self.sub_proc = subprocess.Popen(
31
  cmd_args,
32
  cwd=cwd,
33
- stdout=subprocess.PIPE,
34
- stderr=subprocess.PIPE,
35
  preexec_fn= os.setsid
36
  )
37
  print(f"translator started, PID: {self.sub_proc.pid}")
@@ -67,11 +67,6 @@ class AppRunner:
67
  os.killpg(pgid, signal.SIGKILL)
68
  self.sub_proc.wait(timeout=10)
69
  print("进程组已被强制杀死。")
70
- # stdout, stderr = self.sub_proc.communicate()
71
- # print("\n最终 STDOUT:")
72
- # print(stdout)
73
- # print("\n最终 STDERR:")
74
- # print(stderr)
75
 
76
  if __name__ == '__main__':
77
  app = AppRunner(RunType.code)
 
30
  self.sub_proc = subprocess.Popen(
31
  cmd_args,
32
  cwd=cwd,
33
+ stdout=subprocess.DEVNULL,
34
+ stderr=subprocess.DEVNULL,
35
  preexec_fn= os.setsid
36
  )
37
  print(f"translator started, PID: {self.sub_proc.pid}")
 
67
  os.killpg(pgid, signal.SIGKILL)
68
  self.sub_proc.wait(timeout=10)
69
  print("进程组已被强制杀死。")
 
 
 
 
 
70
 
71
  if __name__ == '__main__':
72
  app = AppRunner(RunType.code)