Skip to content

Commit

Permalink
use os.exec instead
Browse files Browse the repository at this point in the history
  • Loading branch information
z4yx committed Jul 14, 2019
1 parent 6bc5c67 commit 1078b8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ before_install:
install:
-
script:
- GOARCH=amd64 GOOS=linux go build -o auth-thu.linux.x86_64 ./cli
- GOARCH=amd64 GOOS=darwin go build -o auth-thu.macos ./cli
- GOARCH=amd64 GOOS=windows go build -o auth-thu.win64.exe ./cli
- GOARCH=arm64 GOOS=linux go build -o auth-thu.linux.arm64 ./cli
- GOARCH=arm GOOS=linux go build -o auth-thu.linux.arm ./cli
- GOARCH=mipsle GOOS=linux GOMIPS=softfloat go build -o auth-thu.linux.mipsle ./cli
- GOARCH=mips GOOS=linux GOMIPS=softfloat go build -o auth-thu.linux.mipsbe ./cli
- CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o auth-thu.linux.x86_64 ./cli
- CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -o auth-thu.macos ./cli
- CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -o auth-thu.win64.exe ./cli
- CGO_ENABLED=0 GOARCH=arm64 GOOS=linux go build -o auth-thu.linux.arm64 ./cli
- CGO_ENABLED=0 GOARCH=arm GOOS=linux go build -o auth-thu.linux.arm ./cli
- CGO_ENABLED=0 GOARCH=mipsle GOOS=linux GOMIPS=softfloat go build -o auth-thu.linux.mipsle ./cli
- CGO_ENABLED=0 GOARCH=mips GOOS=linux GOMIPS=softfloat go build -o auth-thu.linux.mipsbe ./cli
- ./auth-thu.linux.x86_64 -h
deploy:
provider: releases
Expand Down
12 changes: 5 additions & 7 deletions cli/main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package main

// #include <stdlib.h>
import "C"

import (
"bufio"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
"unsafe"

"github.com/howeyc/gopass"
"github.com/juju/loggo"
Expand Down Expand Up @@ -125,9 +122,10 @@ func parseSettings(c *cli.Context) error {
func runHook(c *cli.Context) {
if settings.HookSucc != "" {
logger.Debugf("Run hook \"%s\"\n", settings.HookSucc)
cs := C.CString(settings.HookSucc)
C.system(cs)
C.free(unsafe.Pointer(cs))
cmd := exec.Command(settings.HookSucc)
if err := cmd.Run(); err != nil {
logger.Errorf("Hook execution failed: %v\n", err)
}
}
}

Expand Down

0 comments on commit 1078b8c

Please sign in to comment.