add linux / windows build files

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-14 04:20:29 -07:00
parent 437afc794c
commit 60671c1308
3 changed files with 49 additions and 8 deletions

31
linux.go Normal file
View File

@ -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()
}

View File

@ -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
}

18
windows.go Normal file
View File

@ -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")
}