| 12345678910111213141516171819202122232425262728 |
- //go:build !windows
- // phone_record_other.go — 非 Windows 下 scrcpy 录屏的进程控制(占位)。
- // scrcpy 在 Unix 下接收 SIGINT 优雅结束;这里用 Kill 兜底。
- package main
- import (
- "os"
- "os/exec"
- )
- // prepareRecordProcess 在非 Windows 平台无额外进程组设置(scrcpy 前台运行)。
- func prepareRecordProcess(cmd *exec.Cmd) {
- // Unix 下不需要隐藏窗口/进程组,保持默认
- _ = cmd
- }
- // stopRecordProcess 在非 Windows 平台发送 SIGINT(scrcpy 收到后保存录制退出)。
- func stopRecordProcess(pid int) error {
- if pid <= 0 {
- return os.ErrInvalid
- }
- p, err := os.FindProcess(pid)
- if err != nil {
- return err
- }
- return p.Signal(os.Interrupt)
- }
|