From f6d4f422c9287e8009cec6a098fd2abc199f3906 Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Mon, 8 Dec 2025 21:35:58 +0000 Subject: [PATCH 1/6] differentiate actual error and non-zero exit code --- app/child.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/child.go b/app/child.go index 910da85..b9d4b7f 100644 --- a/app/child.go +++ b/app/child.go @@ -3,7 +3,6 @@ package app import ( "context" "fmt" - "log" "log/slog" "os" "os/exec" @@ -85,9 +84,22 @@ func RunChild(logger *slog.Logger, args []string) error { cmd.Stderr = os.Stderr err = cmd.Run() if err != nil { - log.Printf("failed to run %s: %v", bin, err) + // Check if this is a normal exit with non-zero status code + if exitError, ok := err.(*exec.ExitError); ok { + exitCode := exitError.ExitCode() + // Log at debug level for non-zero exits (normal behavior) + logger.Debug("Command exited with non-zero status", "exit_code", exitCode) + // Exit with the same code as the command - don't log as error + // This is normal behavior (commands can exit with any code) + os.Exit(exitCode) + } + // This is an unexpected error (not just a non-zero exit) + // Only log actual errors like "command not found" or "permission denied" + logger.Error("Command execution failed", "error", err) return err } + // Command exited successfully + logger.Debug("Command completed successfully") return nil } From b44ed55b9157557bc907dff8bedf39ad9c123ccf Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Mon, 8 Dec 2025 21:52:21 +0000 Subject: [PATCH 2/6] handle non-zero exit code on parent level --- app/parent.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/parent.go b/app/parent.go index 93afb43..4539219 100644 --- a/app/parent.go +++ b/app/parent.go @@ -5,6 +5,7 @@ import ( "fmt" "log/slog" "os" + "os/exec" "os/signal" "strings" "syscall" @@ -139,9 +140,18 @@ func RunParent(ctx context.Context, logger *slog.Logger, args []string, config C logger.Debug("waiting on a child process to finish") err = cmd.Wait() if err != nil { - logger.Error("Command execution failed", "error", err) + // Check if this is a normal exit with non-zero status code + if exitError, ok := err.(*exec.ExitError); ok { + exitCode := exitError.ExitCode() + // Log at debug level for non-zero exits (normal behavior) + logger.Debug("Command exited with non-zero status", "exit_code", exitCode) + } else { + // This is an unexpected error (not just a non-zero exit) + logger.Error("Command execution failed", "error", err) + } return } + logger.Debug("Command completed successfully") }() // Wait for signal or context cancellation From 8f2c6e74c516bafdc2b779d754cc6544676428d2 Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Mon, 8 Dec 2025 22:14:03 +0000 Subject: [PATCH 3/6] increase timeout --- e2e_tests/boundary_integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/boundary_integration_test.go b/e2e_tests/boundary_integration_test.go index 032cf56..cc5c196 100644 --- a/e2e_tests/boundary_integration_test.go +++ b/e2e_tests/boundary_integration_test.go @@ -217,7 +217,7 @@ func TestContentLengthHeader(t *testing.T) { boundaryCmd := exec.CommandContext(ctx, "/tmp/boundary-test", "--allow", "domain=example.com", "--log-level", "debug", - "--", "/bin/bash", "-c", "/usr/bin/sleep 10 && /usr/bin/echo 'Test completed'") + "--", "/bin/bash", "-c", "/usr/bin/sleep 20 && /usr/bin/echo 'Test completed'") boundaryCmd.Stdin = os.Stdin boundaryCmd.Stdout = os.Stdout From 5ba499c39a9b6b72cc409035118a3d758fb1ac0d Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Tue, 9 Dec 2025 15:13:58 +0000 Subject: [PATCH 4/6] SSH session --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4af046..e1249ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,9 @@ jobs: - name: Run unit tests run: make unit-test + - name: Start SSH session + uses: mxschmitt/action-tmate@v3 + - name: Run e2e tests run: make e2e-test if: matrix.os == 'ubuntu-latest' From 2502674e726847c7f9067dfa3b2cffbd028ad3cb Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Tue, 9 Dec 2025 15:25:46 +0000 Subject: [PATCH 5/6] comment out SSH session --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1249ce..b8f9d77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,8 +107,8 @@ jobs: - name: Run unit tests run: make unit-test - - name: Start SSH session - uses: mxschmitt/action-tmate@v3 +# - name: Start SSH session +# uses: mxschmitt/action-tmate@v3 - name: Run e2e tests run: make e2e-test From f595696ba4fa4e41ea846f0aad7fcd243145a4c9 Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Tue, 9 Dec 2025 15:29:36 +0000 Subject: [PATCH 6/6] decrease timeout --- e2e_tests/boundary_integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/boundary_integration_test.go b/e2e_tests/boundary_integration_test.go index cc5c196..032cf56 100644 --- a/e2e_tests/boundary_integration_test.go +++ b/e2e_tests/boundary_integration_test.go @@ -217,7 +217,7 @@ func TestContentLengthHeader(t *testing.T) { boundaryCmd := exec.CommandContext(ctx, "/tmp/boundary-test", "--allow", "domain=example.com", "--log-level", "debug", - "--", "/bin/bash", "-c", "/usr/bin/sleep 20 && /usr/bin/echo 'Test completed'") + "--", "/bin/bash", "-c", "/usr/bin/sleep 10 && /usr/bin/echo 'Test completed'") boundaryCmd.Stdin = os.Stdin boundaryCmd.Stdout = os.Stdout