diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-04 14:32:22 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-04 14:32:22 -0500 |
commit | f90a14d5d723c5d2b87f2eaa19f441dec33bb9b2 (patch) | |
tree | e0abd76b6ebd9adcc60732d532cb68c512b0c2d1 /softscript.go | |
parent | a0b020a78eb0b33965c59460fc093c6959216e44 (diff) | |
download | deb-planr-f90a14d5d723c5d2b87f2eaa19f441dec33bb9b2.tar.xz deb-planr-f90a14d5d723c5d2b87f2eaa19f441dec33bb9b2.zip |
Prototyped build pipeline
Diffstat (limited to 'softscript.go')
-rw-r--r-- | softscript.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/softscript.go b/softscript.go new file mode 100644 index 0000000..9924d54 --- /dev/null +++ b/softscript.go @@ -0,0 +1,42 @@ +package planr + +import ( + "io" + "os" + "os/exec" + "log" +) + +func RunCmd(name string, args ...string) { + cmd := exec.Command(name, args...) + + stderr, err := cmd.StderrPipe() + if err != nil { + log.Fatal(err); + } + + stdout, err := cmd.StdoutPipe() + if err != nil { + log.Fatal(err); + } + + go func() { + io.Copy(os.Stderr, stderr) + }() + + go func() { + io.Copy(os.Stdout, stdout) + }() + + if err := cmd.Start(); err != nil { + log.Fatal(err) + } + + if err != nil { + log.Fatal(err) + } + + if err := cmd.Wait(); err != nil { + log.Fatalf("Could not execute cmake command\n%v", err) + } +} |