如何重新拥有一个流程?

如何重新拥有一个流程?

当我使用快捷方式(sxhkd)运行此脚本时:

#!/bin/sh

MUSIC_DIR="$HOME/music"

songs=$(ls "$MUSIC_DIR")

filename=$( echo -e "random\n$songs" | dmenu -l 30 -i -p "Play >> ")

if [[ $filename = "random" ]]
then
    filename=$(ls "$MUSIC_DIR" |shuf -n 1)
fi

if [[ -f "$MUSIC_DIR/$filename" ]]
then
    notify-send -t 2500 "$filename is playing" &&  mpv "$MUSIC_DIR/$filename" --no-audio-display
else
    notify-send -t 1500 "typo?"
fi

我想在上面打开一个终端控制mpv进程(获取mpv终端界面)。

我尝试过reptyr,但收到此错误。

~ λ  reptyr $(pgrep mpv)
[-] Process 514610 (dmenuMusic) shares 514636's process group. Unable to attach.
(This most commonly means that 514636 has sub-processes).
Unable to attach to pid 514636: Invalid argument

还尝试过:

~ λ  echo 0 | doas tee /proc/sys/kernel/yama/ptrace_scope

它只是不起作用,给了我同样的错误。

相关内容