Skip to content

Commit 728d9ab

Browse files
committed
fix tools executed in visible shell on Windows
1 parent d128503 commit 728d9ab

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

programmer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ func spHandlerProgram(flasher string, cmdString []string) {
210210

211211
extension := ""
212212
if runtime.GOOS == "windows" {
213+
tellCommandNotToSpawnShell(oscmd)
213214
extension = ".exe"
214215
}
215216

seriallist_darwin.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ func associateVidPidWithPort(ports []OsSerialPort) []OsSerialPort {
5959

6060
func hideFile(path string) {
6161
}
62+
63+
func tellCommandNotToSpawnShell(_ *exec.Cmd) {
64+
}

seriallist_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ func associateVidPidWithPort(ports []OsSerialPort) []OsSerialPort {
3535

3636
func hideFile(path string) {
3737
}
38+
39+
func tellCommandNotToSpawnShell(_ *exec.Cmd) {
40+
}

seriallist_windows.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/mattn/go-ole"
66
"github.com/mattn/go-ole/oleutil"
77
"os"
8+
"os/exec"
89
"regexp"
910
"strings"
1011
"sync"
@@ -232,3 +233,7 @@ func convertByteArrayToUint16Array(b []byte, mylen uint32) []uint16 {
232233
}
233234
return ret
234235
}
236+
237+
func tellCommandNotToSpawnShell(oscmd *exec.Cmd) {
238+
oscmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
239+
}

0 commit comments

Comments
 (0)