diff --git a/internal/boxcli/midcobra/midcobra.go b/internal/boxcli/midcobra/midcobra.go index 5b8541fdd7e..aa3ffa170df 100644 --- a/internal/boxcli/midcobra/midcobra.go +++ b/internal/boxcli/midcobra/midcobra.go @@ -60,19 +60,12 @@ func (ex *midcobraExecutable) Execute(ctx context.Context, args []string) int { // Execute the cobra command: err := ex.cmd.Execute() - var postRunErr error - var userExecErr *usererr.ExitError - // If the error is from a user exec call, exclude such error from postrun hooks. - if err != nil && !errors.As(err, &userExecErr) { - postRunErr = err - } - // Run the 'post' hooks. Note that unlike the default PostRun cobra functionality these // run even if the command resulted in an error. This is useful when we still want to clean up // before the program exists or we want to log something. The error, if any, gets passed // to the post hook. for i := len(ex.middlewares) - 1; i >= 0; i-- { - ex.middlewares[i].postRun(ex.cmd, args, postRunErr) + ex.middlewares[i].postRun(ex.cmd, args, err) } if err != nil { diff --git a/internal/boxcli/midcobra/telemetry.go b/internal/boxcli/midcobra/telemetry.go index f5805303da3..aefe6de94c9 100644 --- a/internal/boxcli/midcobra/telemetry.go +++ b/internal/boxcli/midcobra/telemetry.go @@ -8,10 +8,12 @@ import ( "runtime/trace" "sort" + "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" "go.jetpack.io/devbox" "go.jetpack.io/devbox/internal/boxcli/featureflag" + "go.jetpack.io/devbox/internal/boxcli/usererr" "go.jetpack.io/devbox/internal/envir" "go.jetpack.io/devbox/internal/impl/devopt" "go.jetpack.io/devbox/internal/telemetry" @@ -40,6 +42,11 @@ func (m *telemetryMiddleware) postRun(cmd *cobra.Command, args []string, runErr defer trace.StartRegion(cmd.Context(), "telemetryPostRun").End() defer telemetry.Stop() + var userExecErr *usererr.ExitError + if errors.As(runErr, &userExecErr) { + return + } + meta := telemetry.Metadata{ FeatureFlags: featureflag.All(), CloudRegion: os.Getenv(envir.DevboxRegion), diff --git a/plugins/poetry.json b/plugins/poetry.json index 681396074c9..5ee9833d987 100644 --- a/plugins/poetry.json +++ b/plugins/poetry.json @@ -1,7 +1,7 @@ { "name": "poetry", - "version": "0.0.1", - "readme": "This plugin automatically configures poetry to use the version of python installed in your Devbox shell, instead of the Python version that it is bundled with.", + "version": "0.0.2", + "readme": "This plugin automatically configures poetry to use the version of python installed in your Devbox shell, instead of the Python version that it is bundled with. Your pyproject.toml must be in the same directory as your devbox.json.", "env": { "POETRY_VIRTUALENVS_IN_PROJECT": "true", "POETRY_VIRTUALENVS_CREATE": "true", @@ -9,7 +9,7 @@ }, "shell": { "init_hook": [ - "poetry env use $(command -v python) --quiet --no-interaction" + "poetry env use $(command -v python) --no-interaction" ] } }