Skip to content

Commit

Permalink
Add process attribute HideWindow: true for windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
vansante committed Jun 21, 2020
1 parent 01fdea7 commit aa96bd4
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 aa96bd4

Please sign in to comment.