Skip to content

Commit 89295b7

Browse files
committed
chore: Expanding lll coverage to os-exec
1 parent e480c4e commit 89295b7

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ linters:
114114
# trying to get this merged in.
115115
- linters:
116116
- lll
117-
path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|exec|find|help|list|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/prepare/|internal/runner/(common|graph|run/creds/providers/(amazonsts|externalcmd))/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/placeholders|writer)/)'
117+
path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|exec|find|help|list|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/os/exec/|internal/prepare/|internal/runner/(common|graph|run/creds/providers/(amazonsts|externalcmd))/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/placeholders|writer)/)'
118118
paths:
119119
- docs
120120
- _ci

internal/os/exec/cmd.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,19 @@ func (cmd *Cmd) Start() error {
9393
return nil
9494
}
9595

96-
// RegisterGracefullyShutdown registers a graceful shutdown for the command in two ways:
97-
// 1. If the context cancel contains a cause with a signal, this means that Terragrunt received the signal from the OS,
98-
// since our executed command may also receive the same signal, we need to give the command time to gracefully shutting down,
99-
// to avoid the command receiving this signal twice.
100-
// Thus we will send the signal to the executed command with a delay or immediately if Terragrunt receives this same signal again.
101-
// 2. If the context does not contain any causes, this means that there was some failure and we need to terminate all executed commands,
102-
// in this situation we are sure that commands did not receive any signal, so we send them an interrupt signal immediately.
96+
// RegisterGracefullyShutdown registers a graceful shutdown for the
97+
// command in two ways:
98+
// 1. If the context cancel contains a cause with a signal, this means
99+
// that Terragrunt received the signal from the OS, since our
100+
// executed command may also receive the same signal, we need to
101+
// give the command time to gracefully shutting down, to avoid the
102+
// command receiving this signal twice. Thus we will send the signal
103+
// to the executed command with a delay or immediately if Terragrunt
104+
// receives this same signal again.
105+
// 2. If the context does not contain any causes, this means that there
106+
// was some failure and we need to terminate all executed commands,
107+
// in this situation we are sure that commands did not receive any
108+
// signal, so we send them an interrupt signal immediately.
103109
func (cmd *Cmd) RegisterGracefullyShutdown(ctx context.Context) func() {
104110
cmd.gracefulShutdownRegistered.Store(true)
105111

0 commit comments

Comments
 (0)