@@ -18,7 +18,6 @@ import (
18
18
"github.com/pkg/errors"
19
19
"go.jetpack.io/devbox/internal/boxcli/featureflag"
20
20
"go.jetpack.io/devbox/internal/boxcli/usererr"
21
- "go.jetpack.io/devbox/internal/redact"
22
21
23
22
"go.jetpack.io/devbox/internal/debug"
24
23
)
@@ -77,22 +76,15 @@ func (*Nix) PrintDevEnv(ctx context.Context, args *PrintDevEnvArgs) (*PrintDevEn
77
76
if insecure , insecureErr := IsExitErrorInsecurePackage (err , "" /*installable*/ ); insecure {
78
77
return nil , insecureErr
79
78
} else if err != nil {
80
- safeArgs := make ([]string , 0 , len (cmd .Args ))
81
- for _ , a := range cmd .Args {
82
- if a == args .FlakeDir {
83
- a = "<redacted path>"
84
- }
85
- safeArgs = append (safeArgs , a )
86
- }
87
- return nil , redact .Errorf ("nix command: %s" , redact .Safe (safeArgs ))
79
+ return nil , errors .Wrapf (err , "Command: %s" , cmd )
88
80
}
89
81
90
82
if err := json .Unmarshal (data , & out ); err != nil {
91
- return nil , redact . Errorf ( "unmarshal nix print-dev-env output: %w" , redact . Safe ( err ) )
83
+ return nil , errors . WithStack ( err )
92
84
}
93
85
94
86
if err = savePrintDevEnvCache (args .PrintDevEnvCachePath , out ); err != nil {
95
- return nil , redact . Errorf ( "savePrintDevEnvCache: %w" , redact . Safe ( err ) )
87
+ return nil , errors . WithStack ( err )
96
88
}
97
89
}
98
90
@@ -183,13 +175,12 @@ func Version() (string, error) {
183
175
cmd := command ("--version" )
184
176
outBytes , err := cmd .Output ()
185
177
if err != nil {
186
- return "" , redact . Errorf ( "nix command: %s" , redact . Safe ( cmd ) )
178
+ return "" , errors . WithStack ( err )
187
179
}
188
180
out := string (outBytes )
189
181
const prefix = "nix (Nix) "
190
182
if ! strings .HasPrefix (out , prefix ) {
191
- return "" , redact .Errorf (`nix command %s: expected %q prefix, but output was: %s` ,
192
- redact .Safe (cmd ), redact .Safe (prefix ), redact .Safe (out ))
183
+ return "" , errors .Errorf (`Expected "%s" prefix, but output from nix --version was: %s` , prefix , out )
193
184
}
194
185
version = strings .TrimSpace (strings .TrimPrefix (out , prefix ))
195
186
return version , nil
0 commit comments