Skip to content
This repository was archived by the owner on Feb 15, 2026. It is now read-only.
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
5 changes: 3 additions & 2 deletions internal/injector/injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"syscall"
)

// signals is defined in signals_unix.go and signals_windows.go

// RunCommand executes a command with the provided secrets injected into the environment.
// It handles signal forwarding and exit code propagation.
func RunCommand(command string, args []string, secrets map[string]string) error {
Expand All @@ -33,8 +35,7 @@ func RunCommand(command string, args []string, secrets map[string]string) error

// Handle signals
sigs := make(chan os.Signal, 1)
// Notify on all common signals
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
signal.Notify(sigs, signals...)

// Start the command
if err := cmd.Start(); err != nil {
Expand Down
10 changes: 10 additions & 0 deletions internal/injector/signals_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build !windows

package injector

import (
"os"
"syscall"
)

var signals = []os.Signal{syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP}
14 changes: 14 additions & 0 deletions internal/injector/signals_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//go:build windows

package injector

import (
"os"
"syscall"
)

// SIGTERM is included because signal.Notify delivers it on console shutdown events
// (CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT). Note that forwarding
// SIGTERM to child processes via Process.Signal is not supported on Windows —
// the attempt will fail silently.
var signals = []os.Signal{syscall.SIGINT, syscall.SIGTERM}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Loading