aboutsummaryrefslogtreecommitdiff
path: root/dirtyscripting.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-03 19:56:07 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-03 19:56:07 -0500
commitbc26f02dcdd5ce7d3badf8df5065321538c4c872 (patch)
tree8f1e052843de0063a2c42fa622ddfc553b371a79 /dirtyscripting.go
parentff3c1b99f691640a386fd452fa3b3e77769b9138 (diff)
downloadplanr-bc26f02dcdd5ce7d3badf8df5065321538c4c872.tar.xz
planr-bc26f02dcdd5ce7d3badf8df5065321538c4c872.zip
Renamed softscript to dirtyscripting to better describe function
Diffstat (limited to 'dirtyscripting.go')
-rw-r--r--dirtyscripting.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/dirtyscripting.go b/dirtyscripting.go
new file mode 100644
index 0000000..9924d54
--- /dev/null
+++ b/dirtyscripting.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)
+ }
+}