ffmpeg-go icon indicating copy to clipboard operation
ffmpeg-go copied to clipboard

Not support windows

Open hustpython opened this issue 3 years ago • 2 comments

hustpython avatar Nov 06 '22 09:11 hustpython

# github.com/u2takey/ffmpeg-go
(gopath)\pkg\mod\github.com\u2takey\[email protected]
f\run.go:247:42: unknown field 'Setpgid' in struct literal of type syscall.SysProcAttr
(gopath)\code\pkg\mod\github.com\u2takey\[email protected]
f\run.go:247:57: unknown field 'Pgid' in struct literal of type syscall.SysProcAttr

since Add support for compilation options(https://github.com/u2takey/ffmpeg-go/commit/205828f3ee4991eea97e2ce60753712bbaaff2b8)

it doesn't work in windows because syscall.SysProcAttr of windows doesn't have Setpgid field.

Windows

https://github.com/golang/go/blob/d5de62df152baf4de6e9fe81933319b86fd95ae4/src/syscall/exec_windows.go#L243-L253

type SysProcAttr struct {
	HideWindow                 bool
	CmdLine                    string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess
	CreationFlags              uint32
	Token                      Token               // if set, runs new process in the security context represented by the token
	ProcessAttributes          *SecurityAttributes // if set, applies these security attributes as the descriptor for the new process
	ThreadAttributes           *SecurityAttributes // if set, applies these security attributes as the descriptor for the main thread of the new process
	NoInheritHandles           bool                // if set, each inheritable handle in the calling process is not inherited by the new process
	AdditionalInheritedHandles []Handle            // a list of additional handles, already marked as inheritable, that will be inherited by the new process
	ParentProcess              Handle              // if non-zero, the new process regards the process given by this handle as its parent process, and AdditionalInheritedHandles, if set, should exist in this parent process
}

macOS (and any other bsd)

https://github.com/golang/go/blob/d5de62df152baf4de6e9fe81933319b86fd95ae4/src/syscall/exec_bsd.go#L14-L36

type SysProcAttr struct {
	Chroot     string      // Chroot.
	Credential *Credential // Credential.
	Ptrace     bool        // Enable tracing.
	Setsid     bool        // Create session.
	// Setpgid sets the process group ID of the child to Pgid,
	// or, if Pgid == 0, to the new child's process ID.
	Setpgid bool
	// Setctty sets the controlling terminal of the child to
	// file descriptor Ctty. Ctty must be a descriptor number
	// in the child process: an index into ProcAttr.Files.
	// This is only meaningful if Setsid is true.
	Setctty bool
	Noctty  bool // Detach fd 0 from controlling terminal
	Ctty    int  // Controlling TTY fd
	// Foreground places the child process group in the foreground.
	// This implies Setpgid. The Ctty field must be set to
	// the descriptor of the controlling TTY.
	// Unlike Setctty, in this case Ctty must be a descriptor
	// number in the parent process.
	Foreground bool
	Pgid       int // Child's process group ID if Setpgid.
}

zrma avatar Nov 24 '22 14:11 zrma

since Add support for compilation options(https://github.com/u2takey/ffmpeg-go/commit/205828f3ee4991eea97e2ce60753712bbaaff2b8)

it doesn't work in windows because syscall.SysProcAttr of windows doesn't have Setpgid field.

well, there goes 80% of developers

ivanjaros avatar Feb 08 '23 07:02 ivanjaros