![如何重新拥有一个流程?](https://linux22.com/image/226558/%E5%A6%82%E4%BD%95%E9%87%8D%E6%96%B0%E6%8B%A5%E6%9C%89%E4%B8%80%E4%B8%AA%E6%B5%81%E7%A8%8B%EF%BC%9F.png)
当我使用快捷方式(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
它只是不起作用,给了我同样的错误。