Skip to content

Commit

Permalink
Collect logs
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Dec 7, 2024
1 parent 3e6403b commit ec3c024
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions myst_libre/tools/myst_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def check_mystmd_installed(self):
self.cprint(f"✗ Unexpected error occurred: {str(e)}", "red")
raise

def run_command(self, *args, env_vars={},user=None,group=None):
def run_command(self, *args, env_vars={}, user=None, group=None):
"""
Run a command using the MyST executable.
Expand Down Expand Up @@ -136,15 +136,18 @@ def run_command(self, *args, env_vars={},user=None,group=None):
if process.returncode != 0:
raise subprocess.CalledProcessError(process.returncode, command, output='\n'.join(output), stderr='\n'.join(error_output))

return ''.join(output)
# Capture the output in a variable for logging
command_output = ''.join(output)

return command_output
except subprocess.CalledProcessError as e:
print(f"Error running command: {e}")
print(f"Command output: {e.output}")
print(f"Error output: {e.stderr}")
return None
return None, e.stderr
except Exception as e:
print(f"Unexpected error: {e}")
return None
return None, str(e)

def build(self, *args, user=None, group=None):
"""
Expand Down

0 comments on commit ec3c024

Please sign in to comment.