mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-12-26 01:28:49 +00:00
45aa8feef6
Use the format specifier 'ppid,args' instead of 'ppid command'. POSIX allows either spaces or commas as separators, but busybox only allows commas. Furthermore, 'args' is recognized by POSIX[0] while 'command' is not. On implementations of ps that do recognize 'command', it is simply an alias for 'args', e.g. Debian[1] and FreeBSD[2]. [0]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html [1]: https://manpages.debian.org/bullseye/procps/ps.1.en.html [2]: https://www.freebsd.org/cgi/man.cgi?query=ps
25 lines
334 B
Bash
Executable File
25 lines
334 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
PANE_PID="$1"
|
|
|
|
exit_safely_if_empty_ppid() {
|
|
if [ -z "$PANE_PID" ]; then
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
full_command() {
|
|
ps -ao "ppid,args" |
|
|
sed "s/^ *//" |
|
|
grep "^${PANE_PID}" |
|
|
cut -d' ' -f2-
|
|
}
|
|
|
|
main() {
|
|
exit_safely_if_empty_ppid
|
|
full_command
|
|
}
|
|
main
|