Skip to content

Commit 65857c3

Browse files
committed
fix(install): exit with non-zero code on installation failure
The install command was returning exit code 0 even when installation failed, causing CI steps to continue despite errors.
1 parent 38dcfa1 commit 65857c3

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/cmd/install.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"fmt"
5+
"os"
56
"strings"
67

78
"github.com/dtvem/dtvem/src/internal/config"
@@ -58,15 +59,15 @@ func installSingle(runtimeName, version string) {
5859
ui.Debug("Provider lookup failed: %v", err)
5960
ui.Error("%v", err)
6061
ui.Info("Available runtimes: %v", runtime.List())
61-
return
62+
os.Exit(1)
6263
}
6364

6465
ui.Debug("Using provider: %s (%s)", provider.Name(), provider.DisplayName())
6566

6667
if err := provider.Install(version); err != nil {
6768
ui.Debug("Installation failed: %v", err)
6869
ui.Error("%v", err)
69-
return
70+
os.Exit(1)
7071
}
7172

7273
ui.Success("Successfully installed %s %s", provider.DisplayName(), version)
@@ -238,15 +239,15 @@ func installBulk() {
238239
"python": "3.11.0",
239240
"node": "18.16.0"
240241
}`)
241-
return
242+
os.Exit(1)
242243
}
243244

244245
ui.Info("Found config: %s", configPath)
245246

246247
runtimes, err := config.ReadAllRuntimes(configPath)
247248
if err != nil {
248249
ui.Error("Failed to read config file: %v", err)
249-
return
250+
os.Exit(1)
250251
}
251252

252253
if len(runtimes) == 0 {
@@ -276,4 +277,9 @@ func installBulk() {
276277

277278
// Show final summary
278279
showInstallSummary(successCount, alreadyInstalledCount, failureCount, failures)
280+
281+
// Exit with error if any installations failed
282+
if failureCount > 0 {
283+
os.Exit(1)
284+
}
279285
}

0 commit comments

Comments
 (0)