summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-06-14 04:20:29 -0700
committerJeff Carr <[email protected]>2019-06-14 04:20:29 -0700
commit60671c1308c325ab7dfcc59639d34b9c1fcc9b1b (patch)
tree83b7ebde15a7c44b6e65a68c607e796d1b7d9955
parent437afc794c0a311bd03e464788a5716bf568e71c (diff)
add linux / windows build files
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--linux.go31
-rw-r--r--shell.go8
-rw-r--r--windows.go18
3 files changed, 49 insertions, 8 deletions
diff --git a/linux.go b/linux.go
new file mode 100644
index 0000000..e54e2fa
--- /dev/null
+++ b/linux.go
@@ -0,0 +1,31 @@
+// +build linux,go1.7
+
+// put stuff in here that you only want compiled under linux
+
+package shell
+
+import "log"
+import "os"
+import "os/signal"
+import "syscall"
+
+// import "runtime"
+// import "time"
+// import "reflect"
+
+// import "git.wit.com/wit/shell"
+// import "github.com/davecgh/go-spew/spew"
+
+import "github.com/wercker/journalhook"
+
+var sigChan chan os.Signal
+
+func handleSignal(err interface{}, ret int) {
+ log.Println("handleSignal() only should be compiled on linux")
+ sigChan = make(chan os.Signal, 3)
+ signal.Notify(sigChan, syscall.SIGUSR1)
+}
+
+func UseJournalctl() {
+ journalhook.Enable()
+}
diff --git a/shell.go b/shell.go
index cfa9b94..5f947a6 100644
--- a/shell.go
+++ b/shell.go
@@ -15,8 +15,6 @@ import "github.com/svent/go-nbreader"
// import "log"
import log "github.com/sirupsen/logrus"
-// TODO this journalhook to be cross platform
-// import "github.com/wercker/journalhook"
// TODO: look at https://github.com/go-cmd/cmd/issues/20
// use go-cmd instead here?
@@ -66,12 +64,6 @@ func Script(cmds string) int {
return 0
}
-/*
-func UseJournalctl() {
- journalhook.Enable()
-}
-*/
-
func SpewOn() {
spewOn = true
}
diff --git a/windows.go b/windows.go
new file mode 100644
index 0000000..0bd3aa2
--- /dev/null
+++ b/windows.go
@@ -0,0 +1,18 @@
+// +build windows
+
+// put stuff in here that you only want compiled under windows
+
+package shell
+
+import "log"
+
+// import "git.wit.com/wit/shell"
+// import "github.com/davecgh/go-spew/spew"
+
+func handleSignal(err interface{}, ret int) {
+ log.Println("handleSignal() windows doesn't do signals")
+}
+
+func UseJournalctl() {
+ log.Println("journalctl doesn't exist on windows")
+}