Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-22 14:02:42 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-07 08:37:22 +0300
commit437f1aaf49344b8d9291b42979af0263c76ebcf6 (patch)
tree5551d5c1e20dde00696746d4b08191165cc235d7
parented43ae6115e4b373909bbcf027d1f802d5cdefa9 (diff)
testhelper: Open-code check for process's error codes
While the "command" package provides a nice helper to check for process's error codes, use of the "command" package in the testhelper keeps us from using leak checkers in the "command" package itself. Open-code this function in the testhelper package to reduce dependencies to the "command" package.
-rw-r--r--internal/testhelper/leakage.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/testhelper/leakage.go b/internal/testhelper/leakage.go
index 6afb1f94d..d20843580 100644
--- a/internal/testhelper/leakage.go
+++ b/internal/testhelper/leakage.go
@@ -61,8 +61,12 @@ func mustFindNoRunningChildProcess() error {
return fmt.Errorf("found running child processes %s:\n%s", pidsComma, psOut)
}
- if status, ok := command.ExitStatus(err); ok && status == 1 {
- // Exit status 1 means no processes were found
+ exitError, ok := err.(*exec.ExitError)
+ if !ok {
+ return fmt.Errorf("expected ExitError, got %T", err)
+ }
+
+ if exitError.ExitCode() == 1 {
return nil
}