Hide console on windows
The companion does no longer show a terminal window pop up
This commit is contained in:
@@ -57,7 +57,9 @@ func runOpenCommand(template, path string) error {
|
|||||||
if !sawPath {
|
if !sawPath {
|
||||||
tokens = append(tokens, path)
|
tokens = append(tokens, path)
|
||||||
}
|
}
|
||||||
return exec.Command(tokens[0], tokens[1:]...).Start()
|
cmd := exec.Command(tokens[0], tokens[1:]...)
|
||||||
|
hideConsole(cmd)
|
||||||
|
return cmd.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
// tokenizeCommand splits a command-line string into argv tokens, honouring
|
// tokenizeCommand splits a command-line string into argv tokens, honouring
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "os/exec"
|
||||||
|
|
||||||
|
// Allows running commands without showing a terminal window on startup when not running on windows
|
||||||
|
func hideConsole(*exec.Cmd) {}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is the windows CREATE_NO_WINDOW syscall.
|
||||||
|
// We have no golang.org/x/sys dependency, so this will suffice
|
||||||
|
const createNoWindow = 0x08000000
|
||||||
|
|
||||||
|
// Allows running commands without showing a terminal window on startup on windows
|
||||||
|
func hideConsole(cmd *exec.Cmd) {
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
HideWindow: true,
|
||||||
|
CreationFlags: createNoWindow,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "1"
|
const version = "2"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|||||||
Reference in New Issue
Block a user