From 9dc3f8c639cb8b1d868002a037b7edbf39f3dd12 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Tue, 11 Sep 2018 11:16:30 +0200 Subject: [PATCH] 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 --- CHANGELOG.md | 2 ++ save_command_strategies/ps.sh | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5368e..b4bf7dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ - allow using '$HOSTNAME' in @resurrect-dir - add zsh history saving and restoring - 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 - add "tmux-test" diff --git a/save_command_strategies/ps.sh b/save_command_strategies/ps.sh index 47223c5..544426c 100755 --- a/save_command_strategies/ps.sh +++ b/save_command_strategies/ps.sh @@ -10,16 +10,8 @@ exit_safely_if_empty_ppid() { fi } -ps_command_flags() { - case $(uname -s) in - FreeBSD) echo "-ao" ;; - OpenBSD) echo "-ao" ;; - *) echo "-eo" ;; - esac -} - full_command() { - ps "$(ps_command_flags)" "ppid command" | + ps -ao "ppid command" | sed "s/^ *//" | grep "^${PANE_PID}" | cut -d' ' -f2-