Skip to content

Commit

Permalink
Merge pull request #21 from vansante/set-hide-window-windows
Browse files Browse the repository at this point in the history
Add process attribute HideWindow: true for windows builds
  • Loading branch information
vansante authored Jun 21, 2020
2 parents 01fdea7 + aa96bd4 commit 4b189b6
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ffprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func ProbeURL(ctx context.Context, fileURL string, extraFFProbeOptions ...string
args = append(args, fileURL)

cmd := exec.CommandContext(ctx, binPath, args...)
cmd.SysProcAttr = procAttributes()

return runProbe(cmd)
}
Expand All @@ -55,6 +56,7 @@ func ProbeReader(ctx context.Context, reader io.Reader, extraFFProbeOptions ...s

cmd := exec.CommandContext(ctx, binPath, args...)
cmd.Stdin = reader
cmd.SysProcAttr = procAttributes()

return runProbe(cmd)
}
Expand Down
13 changes: 13 additions & 0 deletions proc_attr_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// +build linux

package ffprobe

import (
"syscall"
)

func procAttributes() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
Pdeathsig: syscall.SIGINT,
}
}
11 changes: 11 additions & 0 deletions proc_attr_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build !linux,!windows

package ffprobe

import (
"syscall"
)

func procAttributes() *syscall.SysProcAttr {
return nil
}
13 changes: 13 additions & 0 deletions proc_attr_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// +build windows

package ffprobe

import (
"syscall"
)

func procAttributes() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
HideWindow: true,
}
}

0 comments on commit 4b189b6

Please sign in to comment.