tss/exp/exec/exec.go

20 lines
290 B
Go
Raw Normal View History

2022-04-26 09:55:59 -04:00
package main
import (
"fmt"
"os/exec"
)
func main() {
fmt.Println("vim-go")
c := exec.Command("./script.sh")
op, err := c.Output()
if err != nil {
fmt.Println(err)
exitErr := err.(*exec.ExitError)
fmt.Printf("hello %s\n", exitErr.Stderr)
} else {
fmt.Printf("%s", op)
}
}