diff --git a/bip/pipelines/struct_FS/FS_proc.py b/bip/pipelines/struct_FS/FS_proc.py index 1a7255808e5da712ad63fbfb6c200e372ec33eab..4022122455152c2f2eef26f3964d0da9de891033 100755 --- a/bip/pipelines/struct_FS/FS_proc.py +++ b/bip/pipelines/struct_FS/FS_proc.py @@ -31,7 +31,7 @@ def run(ctx, if os.path.exists(FreeSurfer_dir): shutil.rmtree(FreeSurfer_dir) - subjects_dir=os.getcwd() + env = dict(os.environ, SUBJECTS_DIR=os.getcwd()) os.environ["SUBJECTS_DIR"] = subjects_dir + "/" + ctx.subject T1_path = subjects_dir + "/" + T1_unbiased @@ -42,7 +42,7 @@ def run(ctx, if os.path.exists(T2_FLAIR_unbiased): cmd += " -FLAIR " + T2_path + " -FLAIRpial" - output = run_command(log, cmd) + output = run_command(log, cmd, env) log.info(output) diff --git a/bip/utils/log_utils.py b/bip/utils/log_utils.py index abcc8700913ce1b0b8fcb39e5caaa8f205e717b6..d40dd9093334ff27d49f724f1374e4fb7f12e8cc 100755 --- a/bip/utils/log_utils.py +++ b/bip/utils/log_utils.py @@ -22,10 +22,10 @@ from subprocess import check_output from fsl import wrappers -def run_command(logger, command): +def run_command(logger, command, env): try: logger.info('COMMAND TO RUN: \t' + command.strip()) - job_output = check_output(command, shell=True).decode('UTF-8') + job_output = check_output(command, shell=True, env=env).decode('UTF-8') logger.info('COMMAND OUTPUT: \t' + job_output.strip()) except Exception as e: logger.error('Exception raised during: \t' + command.strip())