this is how you solve the linux vs windows compile solution

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-06 10:57:57 -07:00
parent a6b312d6a3
commit 7706146f17
3 changed files with 26 additions and 2 deletions

View File

@ -298,6 +298,7 @@ func parseConfig() {
errChan <- fmt.Errorf("mainMouseClick() got b = nil") errChan <- fmt.Errorf("mainMouseClick() got b = nil")
errChan <- "hello" errChan <- "hello"
handleSignal(nil, 0)
// my pid (cross platform) p, err := os.FindProcess(os.Getpid()) // my pid (cross platform) p, err := os.FindProcess(os.Getpid())
// send signal (cross platform) return p.Signal(syscall.SIGTERM) // send signal (cross platform) return p.Signal(syscall.SIGTERM)

View File

@ -1,5 +1,7 @@
// +build linux,go1.7 // +build linux,go1.7
// put stuff in here that you only want compiled under linux
package main package main
import "log" import "log"
@ -14,8 +16,8 @@ import "syscall"
// import "git.wit.com/wit/shell" // import "git.wit.com/wit/shell"
// import "github.com/davecgh/go-spew/spew" // import "github.com/davecgh/go-spew/spew"
func handleLinux(err interface{}, ret int) { func handleSignal(err interface{}, ret int) {
log.Println("handleSignal() only should be compiled on linux")
sigChan = make(chan os.Signal, 3) sigChan = make(chan os.Signal, 3)
log.Println("handleLinux() only should be compiled on linux")
signal.Notify(sigChan, syscall.SIGUSR1) signal.Notify(sigChan, syscall.SIGUSR1)
} }

21
windows.go Normal file
View File

@ -0,0 +1,21 @@
// +build windows
// put stuff in here that you only want compiled under windows
package main
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"
func handleSignal(err interface{}, ret int) {
log.Println("handleSignal() windows doesn't do signals")
}