This commit is contained in:
Dun Liang 2020-04-01 17:07:06 +08:00
parent a112d0fb86
commit 195f754cba
3 changed files with 6 additions and 4 deletions

View File

@ -190,7 +190,7 @@ def install_cutt(root_folder):
from jittor_utils import run_cmd
LOG.i("installing cutt...")
run_cmd(f"cd {dirname} && make")
run_cmd(f"make", cwd=dirname)
return dirname
def setup_cutt():

View File

@ -103,8 +103,10 @@ def try_import_jit_utils_core(silent=None):
def run_cmd(cmd, cwd=None, err_msg=None, print_error=True):
LOG.v(f"Run cmd: {cmd}")
if cwd: cmd = f"cd {cwd} && {cmd}"
r = sp.run(cmd, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
if cwd:
r = sp.run(cmd, cwd=cwd, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
else:
r = sp.run(cmd, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
s = r.stdout.decode('utf8')
if r.returncode != 0:
if print_error:

View File

@ -44,7 +44,7 @@ jit_op_entry_t load_jit_lib(string name, string symbol_name="jit_entry") {
}
void run_cmd(string cmd, string cwd="") {
if (cwd.size()) cmd = "cd "+cwd + " && " + cmd;
if (cwd.size()) cmd = "cd '"+cwd + "' && " + cmd;
LOGvvv << "Run cmd:" << cmd;
system_with_check(cmd.c_str());
}