Abhishek Thakur commited on
Commit
1f822b1
·
1 Parent(s): 5a5ad1a

update subprocess commands

Browse files
competitions/evaluate.py CHANGED
@@ -1,6 +1,7 @@
1
  import argparse
2
  import json
3
  import os
 
4
  import shutil
5
  import subprocess
6
 
@@ -50,8 +51,10 @@ def generate_submission_file(params):
50
  env = os.environ.copy()
51
  env["LD_PRELOAD"] = socket_kit_path
52
 
 
 
53
  # Start the subprocess
54
- process = subprocess.Popen(cmd, cwd=submission_dir, shell=True, env=env)
55
 
56
  # Wait for the process to complete or timeout
57
  try:
 
1
  import argparse
2
  import json
3
  import os
4
+ import shlex
5
  import shutil
6
  import subprocess
7
 
 
51
  env = os.environ.copy()
52
  env["LD_PRELOAD"] = socket_kit_path
53
 
54
+ cmd = shlex.split(cmd)
55
+
56
  # Start the subprocess
57
+ process = subprocess.Popen(cmd, cwd=submission_dir, env=env)
58
 
59
  # Wait for the process to complete or timeout
60
  try:
competitions/utils.py CHANGED
@@ -1,6 +1,7 @@
1
  import io
2
  import json
3
  import os
 
4
  import subprocess
5
  import traceback
6
 
@@ -58,7 +59,8 @@ def run_evaluation(params, local=False, wait=False):
58
  cmd = [str(c) for c in cmd]
59
  logger.info(cmd)
60
  env = os.environ.copy()
61
- process = subprocess.Popen(" ".join(cmd), shell=True, env=env)
 
62
  if wait:
63
  process.wait()
64
  return process.pid
 
1
  import io
2
  import json
3
  import os
4
+ import shlex
5
  import subprocess
6
  import traceback
7
 
 
59
  cmd = [str(c) for c in cmd]
60
  logger.info(cmd)
61
  env = os.environ.copy()
62
+ cmd = shlex.split(" ".join(cmd))
63
+ process = subprocess.Popen(cmd, env=env)
64
  if wait:
65
  process.wait()
66
  return process.pid