From f95735ababb9e1b2f4a253f1a0aac0fa4a9ece14 Mon Sep 17 00:00:00 2001 From: finnball <finn.ball@codethink.co.uk> Date: Fri, 21 Sep 2018 13:02:37 +0100 Subject: [PATCH] temp-directory bot now returns stderr, stdout and exit code to client. --- buildgrid/_app/bots/temp_directory.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/buildgrid/_app/bots/temp_directory.py b/buildgrid/_app/bots/temp_directory.py index ff0cfe2c9..58c221eb8 100644 --- a/buildgrid/_app/bots/temp_directory.py +++ b/buildgrid/_app/bots/temp_directory.py @@ -74,14 +74,25 @@ def work_temp_directory(context, lease): process = subprocess.Popen(command_line, cwd=working_directory, - universal_newlines=True, env=environment, stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - # TODO: Should return the stdout and stderr in the ActionResult. - process.communicate() + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + stdout, stderr = process.communicate() + returncode = process.returncode action_result = remote_execution_pb2.ActionResult() + # TODO: Upload to CAS or output RAW + # For now, just pass raw + # https://gitlab.com/BuildGrid/buildgrid/issues/90 + action_result.stdout_raw = stdout.encode() + action_result.stderr_raw = stderr.encode() + action_result.exit_code = returncode + + logger.debug("Command stderr: [{}]".format(stderr.encode())) + logger.debug("Command stdout: [{}]".format(stdout.encode())) + logger.debug("Command exit code: [{}]".format(returncode)) with upload(context.cas_channel, instance=instance_name) as cas: for output_path in command.output_files: -- GitLab