mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Fail when command exec workflow fails
This commit is contained in:
+8
-3
@@ -2,9 +2,9 @@ package npm
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/safedep/pmg/config"
|
||||
"github.com/safedep/pmg/internal/ui"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -16,10 +16,15 @@ func NewNpmCommand() *cobra.Command {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
config, err := config.FromContext(cmd.Context())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get config: %w", err)
|
||||
ui.Fatalf("Failed to get config: %s", err)
|
||||
}
|
||||
|
||||
return executeNpmFlow(cmd.Context(), config, args)
|
||||
err = executeNpmFlow(cmd.Context(), config, args)
|
||||
if err != nil {
|
||||
ui.Fatalf("Failed to execute npm flow: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -2,9 +2,9 @@ package npm
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/safedep/pmg/config"
|
||||
"github.com/safedep/pmg/internal/ui"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -16,10 +16,15 @@ func NewPnpmCommand() *cobra.Command {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
config, err := config.FromContext(cmd.Context())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get config: %w", err)
|
||||
ui.Fatalf("Failed to get config: %s", err)
|
||||
}
|
||||
|
||||
return executePnpmFlow(cmd.Context(), config, args)
|
||||
err = executePnpmFlow(cmd.Context(), config, args)
|
||||
if err != nil {
|
||||
ui.Fatalf("Failed to execute pnpm flow: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user