Finish windows support

- Fix service creation
- Singleton lock
- Control error/logging
- Revamp run/service interaction
- Add option to turn off stdout/stderr output (for Windows Service)
- Use log instead of fmt.Print*
This commit is contained in:
Daniel
2019-07-24 09:22:16 +02:00
parent d9ae6a140d
commit c6083fc464
10 changed files with 486 additions and 246 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"log"
"os"
"strings"
@@ -63,8 +64,6 @@ var showNotifier = &cobra.Command{
}
func show(cmd *cobra.Command, opts *Options) error {
defer close(programEnded)
// get original arguments
var args []string
if len(os.Args) < 4 {
@@ -82,8 +81,8 @@ func show(cmd *cobra.Command, opts *Options) error {
return fmt.Errorf("could not get component: %s", err)
}
fmt.Printf("%s command:\n", logPrefix)
fmt.Printf("%s %s\n", file.Path(), strings.Join(args, " "))
log.Println("command:")
log.Printf("%s %s\n", file.Path(), strings.Join(args, " "))
return nil
}