summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Czapliński <czapkofan@gmail.com>2018-04-09 23:38:03 +0200
committerMateusz Czapliński <czapkofan@gmail.com>2018-04-09 23:38:03 +0200
commit77c98efcafbb2cf1baa54504d5cd318c116238a9 (patch)
tree963a5acf27ea7423dff3ec64ae860b21d4a12e7a
parent0e39d8abcdef4bb9a910682da51f83438f8b261a (diff)
add basic --debug flag
-rw-r--r--up.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/up.go b/up.go
index 53b94a3..d3f733a 100644
--- a/up.go
+++ b/up.go
@@ -22,6 +22,8 @@ import (
"context"
"fmt"
"io"
+ "io/ioutil"
+ "log"
"os"
"os/exec"
"sync"
@@ -68,6 +70,15 @@ func main() {
tui.PostEvent(tcell.NewEventInterrupt(nil))
})
+ log.SetOutput(ioutil.Discard)
+ if len(os.Args) > 1 && os.Args[1] == "--debug" {
+ debug, err := os.Create("up.debug")
+ if err != nil {
+ panic(err)
+ }
+ log.SetOutput(debug)
+ }
+
// Main loop
main_loop:
for {
@@ -413,6 +424,7 @@ func StartSubprocess(inputBuf *Buf, command string, signal func()) *Subprocess {
fmt.Fprintf(w, "up: %s", err)
return s
}
+ log.Println(cmd.Path)
go cmd.Wait()
return s
}