Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 14 additions & 2 deletions app/child.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package app
import (
"context"
"fmt"
"log"
"log/slog"
"os"
"os/exec"
Expand Down Expand Up @@ -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
}
12 changes: 11 additions & 1 deletion app/parent.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log/slog"
"os"
"os/exec"
"os/signal"
"strings"
"syscall"
Expand Down Expand Up @@ -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
Expand Down
Loading