Skip to content

Commit

Permalink
feat: returns a non-zero code when package failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Nov 26, 2024
1 parent 1f1974e commit 311a1aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/commandline/bundle/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ func PackageBundle(bundlePath string, outputPath string) {
packager, err := loadBundlePackager(bundlePath)
if err != nil {
log.Error("Failed to load bundle packager: %v", err)
os.Exit(1)
return
}

zipFile, err := packager.Export()
if err != nil {
log.Error("Failed to export bundle: %v", err)
os.Exit(1)
return
}

if err := os.WriteFile(outputPath, zipFile, 0644); err != nil {
log.Error("Failed to write zip file: %v", err)
os.Exit(1)
return
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/commandline/plugin/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func PackagePlugin(inputPath string, outputPath string) {
decoder, err := decoder.NewFSPluginDecoder(inputPath)
if err != nil {
log.Error("failed to create plugin decoder , plugin path: %s, error: %v", inputPath, err)
os.Exit(1)
return
}

Expand All @@ -20,12 +21,14 @@ func PackagePlugin(inputPath string, outputPath string) {

if err != nil {
log.Error("failed to package plugin %v", err)
os.Exit(1)
return
}

err = os.WriteFile(outputPath, zipFile, 0644)
if err != nil {
log.Error("failed to write package file %v", err)
os.Exit(1)
return
}

Expand Down

0 comments on commit 311a1aa

Please sign in to comment.