From 32c787e17971c2ffcfe86e2825bbb4b82f99aa5c Mon Sep 17 00:00:00 2001 From: Jean Humann Date: Wed, 15 Nov 2023 11:15:27 +0100 Subject: [PATCH 1/3] fix: flush stdout and stderr before each command --- server/src/main/resources/shell_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/resources/shell_wrapper.py b/server/src/main/resources/shell_wrapper.py index 038367dd..5bc801c8 100644 --- a/server/src/main/resources/shell_wrapper.py +++ b/server/src/main/resources/shell_wrapper.py @@ -144,8 +144,8 @@ def main(): log.info("Starting session loop") try: while True: - setup_output() for command in controller.read(): + setup_output() log.debug(f"Processing command {command}") result = handler.exec(command) controller.write(command["id"], result) From f93f957931b81a826e38c64175374ff8186b3a3a Mon Sep 17 00:00:00 2001 From: Jean Humann Date: Wed, 15 Nov 2023 11:18:09 +0100 Subject: [PATCH 2/3] fix: return stdout when exception happens --- server/src/main/resources/shell_wrapper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/main/resources/shell_wrapper.py b/server/src/main/resources/shell_wrapper.py index 5bc801c8..88e3e312 100644 --- a/server/src/main/resources/shell_wrapper.py +++ b/server/src/main/resources/shell_wrapper.py @@ -91,6 +91,7 @@ def __init__(self, globals) -> None: def _error_response(self, error): exc_type, exc_value, exc_tb = sys.exc_info() return { + "content": {"text/plain": str(sys.stdout.getvalue()).rstrip()}, "error": type(error).__name__, "message": str(error), "traceback": traceback.format_exception(exc_type, exc_value, exc_tb), From 64dae21bc19d8fb39a58283956f2cd408cfc5c4f Mon Sep 17 00:00:00 2001 From: Jean Humann Date: Wed, 15 Nov 2023 18:20:34 +0100 Subject: [PATCH 3/3] ci: clean container after PR closed --- .github/workflows/clean.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index c37b0199..7c48514a 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -25,7 +25,6 @@ jobs: LOWER_BRANCH=${{ github.event.pull_request.head.ref }} SLUG_BRANCH=$(echo "$LOWER_BRANCH" | sed -e 's/[^a-zA-Z0-9]/-/g' -e 's/--/-/g') echo "BASE_REF=$SLUG_BRANCH" >> $GITHUB_ENV - fi - name: Delete tag on PR close or merge if: github.event_name == 'pull_request' && github.event.action == 'closed' env: