From 6ad2c70e9915a60436dabdb99ba3a5a86f166442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 26 Sep 2023 13:25:36 +0200 Subject: [PATCH] Log agent's log after every test --- end-to-end/utils_test.go | 6 ++++++ gui/packages/ubuntupro/lib/launch_agent.dart | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/end-to-end/utils_test.go b/end-to-end/utils_test.go index e21f825b8..b3a870ca2 100644 --- a/end-to-end/utils_test.go +++ b/end-to-end/utils_test.go @@ -1,6 +1,7 @@ package endtoend_test import ( + "bytes" "context" "errors" "fmt" @@ -75,6 +76,10 @@ func startAgent(t *testing.T, ctx context.Context) (cleanup func()) { //nolint:gosec // The executable is located at the Appx directory cmd := exec.CommandContext(ctx, ubuntupro) + var buff bytes.Buffer + cmd.Stdout = &buff + cmd.Stderr = &buff + err = cmd.Start() require.NoError(t, err, "Setup: could not start agent") @@ -100,6 +105,7 @@ func startAgent(t *testing.T, ctx context.Context) (cleanup func()) { //nolint:errcheck // This returns a "context cancelled" error. cmd.Wait() + t.Logf("Agent stopped. Stdout+stderr: %s", buff.String()) } defer func() { diff --git a/gui/packages/ubuntupro/lib/launch_agent.dart b/gui/packages/ubuntupro/lib/launch_agent.dart index d33097a6c..aa39197f5 100644 --- a/gui/packages/ubuntupro/lib/launch_agent.dart +++ b/gui/packages/ubuntupro/lib/launch_agent.dart @@ -17,8 +17,9 @@ Future launchAgent(String agentRelativePath) async { try { await Process.start( agentPath, - [], + ['-vv'], environment: Environment.instance.merged, + mode: ProcessStartMode.inheritStdio, ); return true; } on ProcessException catch (err) {