Skip to content

Commit

Permalink
Allow to avoid command printing
Browse files Browse the repository at this point in the history
  • Loading branch information
delarosatrevin committed Oct 28, 2024
1 parent 63bc404 commit 072883d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions emtools/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def print(self, args=True, stdout=False):
print(self.stdout)

@staticmethod
def system(cmd, only_print=False, color=None):
def system(cmd, only_print=False, color=None, do_print=True):
""" Execute and print a command.
Args:
Expand All @@ -65,8 +65,9 @@ def system(cmd, only_print=False, color=None):
not executed
color: Optional color for the command
"""
printCmd = cmd if color is None else color(cmd)
print(printCmd)
if do_print:
printCmd = cmd if color is None else color(cmd)
print(printCmd)
if not only_print:
return os.system(cmd)

Expand Down

0 comments on commit 072883d

Please sign in to comment.