Skip to content

os/exec: pause & resume the process executing command on Windows #44564

@Purple-CSGO

Description

@Purple-CSGO

Motivation and What I've done

I'm working on a ffmpeg/x264/x265.... GUI program, and I want to have realtime control: get the progress, pause and resume the encoding process. The challange is how to pause and resume. After searching and trying, I made it on linux/macos by using signal as following:

// pause
cmd.Process.Signal(syscall.SIGTSTP)
// resume
cmd.Process.Signal(syscall.SIGCONT)

Problem and thinking

The problem is on Windows, it does not work. Can't find signals working on windows. I've searched a lot, but failed.

Then I recall that pressing PauseBreak and Enter when encoding in terminal/cmd already has the same effect, yet I've no idea how to send special keyboard hotkey events to the process which is running command in golang. I do have searching but can't find it.

Thanks in advance :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions