Skip to content

Commit

Permalink
Merge pull request #283 from rummik/cmdline
Browse files Browse the repository at this point in the history
Add cmdline save strategy
  • Loading branch information
bruno- committed Dec 17, 2019
2 parents 1160c1d + 2382467 commit 905abba
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions save_command_strategies/linux_procfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

PANE_PID="$1"
COMMAND_PID=$(pgrep -P $PANE_PID)

exit_safely_if_empty_ppid() {
if [ -z "$PANE_PID" ]; then
exit 0
fi
}

full_command() {
[[ -z "$COMMAND_PID" ]] && exit 0
cat /proc/${COMMAND_PID}/cmdline | xargs -0 printf "%q "
}

main() {
exit_safely_if_empty_ppid
full_command
}
main
2 changes: 1 addition & 1 deletion scripts/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ restore_all_pane_processes() {
if restore_pane_processes_enabled; then
local pane_full_command
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $11 !~ "^:$" { print $2, $3, $7, $8, $11; }' $(last_resurrect_file) |
while IFS=$d read session_name window_number pane_index dir pane_full_command; do
while IFS=$d read -r session_name window_number pane_index dir pane_full_command; do
dir="$(remove_first_char "$dir")"
pane_full_command="$(remove_first_char "$pane_full_command")"
restore_pane_process "$pane_full_command" "$session_name" "$window_number" "$pane_index" "$dir"
Expand Down

0 comments on commit 905abba

Please sign in to comment.