Skip to content

bug: run() helper in main.go silently ignores command errors #51

@jpleva91

Description

@jpleva91

Bug: Errors from exec.Command.Run() are silently dropped

File: cmd/shellforge/main.go

The run() helper used throughout cmdSetup() discards the error from cmd.Run():

func run(name string, args ...string) {
    cmd := exec.Command(name, args...)
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    cmd.Run()  // return value discarded
}

Called for every setup step: brew install ollama, ollama pull $model, etc. If any of these fail (network down, brew not installed, disk full) the setup wizard silently continues and reports success.

Fix

func run(name string, args ...string) {
    cmd := exec.Command(name, args...)
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    if err := cmd.Run(); err != nil {
        fmt.Fprintf(os.Stderr, "[shellforge] command failed: %s %v: %v\n", name, args, err)
    }
}

Or propagate the error to callers and let cmdSetup() decide whether to abort or warn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions