Skip to content

Commit

Permalink
added tee to see output of command logs
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelduranfrigola committed Jul 11, 2023
1 parent a4b2b64 commit b37e844
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ersilia/utils/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def run_commandlines(self, environment, commandlines):

tmp_folder = tempfile.mkdtemp(prefix="ersilia-")
tmp_log = os.path.join(tmp_folder, "command_outputs.log")
cmd = "bash {0} > {1} 2>&1".format(tmp_script, tmp_log)
cmd = "bash {0} 2>&1 | tee -a {1}".format(tmp_script, tmp_log)
logger.debug("Running {0}".format(cmd))
run_command(cmd)
with open(tmp_log, "r") as f:
Expand Down
2 changes: 1 addition & 1 deletion ersilia/utils/exceptions_utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def run_from_terminal(self):
tmp_folder = tempfile.mkdtemp(prefix="ersilia-")
log_file = os.path.join(tmp_folder, "terminal.log")
run_command("ersilia example {0} -n 3 -f {1}".format(self.model_id, input_file))
cmd = "bash {0} {1} {2} {3} > {4} 2>&1 ".format(
cmd = "bash {0} {1} {2} {3} 2>&1 | tee -a {4}".format(
exec_file, framework_dir, input_file, output_file, log_file
)
run_command(cmd)
Expand Down
2 changes: 1 addition & 1 deletion ersilia/utils/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def run_commandlines(self, environment, commandlines):
logger.debug("Running {0}".format(tmp_script)) #

# run_command("bash {0}".format(tmp_script))
run_command("bash {0} > {1} 2>&1".format(tmp_script, tmp_log)) #
run_command("bash {0} 2>&1 | tee -a {1}".format(tmp_script, tmp_log)) #
with open(tmp_log, "r") as f:
log_file = f.read()
logger.debug(log_file)
Expand Down

0 comments on commit b37e844

Please sign in to comment.