Always use 'ps -ao' to detect commands

Previously we used 'ps -eo' for some operating systems. It turns out
flags '-ao' work fine for all, and it should also be fine per posix spec

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html#tag_20_96
This commit is contained in:
Bruno Sutic 2018-09-11 11:16:30 +02:00
parent 6feae65a83
commit 9dc3f8c639
No known key found for this signature in database
GPG Key ID: CAFA7B1B2914ED81
2 changed files with 3 additions and 9 deletions

View File

@ -22,6 +22,8 @@
- allow using '$HOSTNAME' in @resurrect-dir - allow using '$HOSTNAME' in @resurrect-dir
- add zsh history saving and restoring - add zsh history saving and restoring
- delete resurrect files older than 30 days, but keep at least 5 files - delete resurrect files older than 30 days, but keep at least 5 files
- add save and restore hooks
- always use `-ao` flags for `ps` command to detect commands
### v2.4.0, 2015-02-23 ### v2.4.0, 2015-02-23
- add "tmux-test" - add "tmux-test"

View File

@ -10,16 +10,8 @@ exit_safely_if_empty_ppid() {
fi fi
} }
ps_command_flags() {
case $(uname -s) in
FreeBSD) echo "-ao" ;;
OpenBSD) echo "-ao" ;;
*) echo "-eo" ;;
esac
}
full_command() { full_command() {
ps "$(ps_command_flags)" "ppid command" | ps -ao "ppid command" |
sed "s/^ *//" | sed "s/^ *//" |
grep "^${PANE_PID}" | grep "^${PANE_PID}" |
cut -d' ' -f2- cut -d' ' -f2-