Skip to content

Commit

Permalink
fix: utils run
Browse files Browse the repository at this point in the history
  • Loading branch information
giusdp committed Jan 12, 2024
1 parent 7f79fda commit 1dad966
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion bin/nuvfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ tasks:
- '{{if eq .OS "windows"}} mv coreutils-0.0.23-x86_64-pc-windows-msvc/{{.TGT}}{{.EXE}} . {{else}} mv {{.TGT}}-extract/{{.TGT}}{{.EXE}} . {{end}}'
- '{{if eq .OS "windows"}} rm -r coreutils-0.0.23-x86_64-pc-windows-msvc {{else}} rm -r {{.TGT}}-extract {{end}}'
- rm -r {{.TGT}}{{.ARC2}}
- rm -r {{.TGT}}-extract
status:
- test -e {{.TGT}}{{.EXE}}

Expand Down
10 changes: 7 additions & 3 deletions tools/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package tools
import (
"fmt"
"os"
"os/exec"

"github.com/nuvolaris/someutils"
"github.com/nuvolaris/someutils/some"
Expand All @@ -45,12 +46,10 @@ func IsUtil(name string) bool {
func RunUtil(name string, args []string) (int, error) {
if IsUtil(name) {
full := append([]string{name}, args...)
fmt.Println(name, full)
var err error
var code int
if useCoreutils() {
code, err = runCoreUtils(name, args)

} else {
err, code = someutils.Call(name, full)
}
Expand All @@ -64,5 +63,10 @@ func useCoreutils() bool {
}

func runCoreUtils(name string, args []string) (int, error) {
return 0, nil
cmd := exec.Command("nuv", "update", "cli")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
code := cmd.ProcessState.ExitCode()
return code, err
}

0 comments on commit 1dad966

Please sign in to comment.