Skip to content

Commit

Permalink
Log agent's log after every test
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Sep 26, 2023
1 parent 2c96334 commit 6ad2c70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions end-to-end/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package endtoend_test

import (
"bytes"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -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")

Expand All @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion gui/packages/ubuntupro/lib/launch_agent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Future<bool> launchAgent(String agentRelativePath) async {
try {
await Process.start(
agentPath,
[],
['-vv'],
environment: Environment.instance.merged,
mode: ProcessStartMode.inheritStdio,
);
return true;
} on ProcessException catch (err) {
Expand Down

0 comments on commit 6ad2c70

Please sign in to comment.