Skip to content

Commit 905abba

Browse files
authored
Merge pull request tmux-plugins#283 from rummik/cmdline
Add cmdline save strategy
2 parents 1160c1d + 2382467 commit 905abba

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
PANE_PID="$1"
6+
COMMAND_PID=$(pgrep -P $PANE_PID)
7+
8+
exit_safely_if_empty_ppid() {
9+
if [ -z "$PANE_PID" ]; then
10+
exit 0
11+
fi
12+
}
13+
14+
full_command() {
15+
[[ -z "$COMMAND_PID" ]] && exit 0
16+
cat /proc/${COMMAND_PID}/cmdline | xargs -0 printf "%q "
17+
}
18+
19+
main() {
20+
exit_safely_if_empty_ppid
21+
full_command
22+
}
23+
main

scripts/restore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ restore_all_pane_processes() {
299299
if restore_pane_processes_enabled; then
300300
local pane_full_command
301301
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $11 !~ "^:$" { print $2, $3, $7, $8, $11; }' $(last_resurrect_file) |
302-
while IFS=$d read session_name window_number pane_index dir pane_full_command; do
302+
while IFS=$d read -r session_name window_number pane_index dir pane_full_command; do
303303
dir="$(remove_first_char "$dir")"
304304
pane_full_command="$(remove_first_char "$pane_full_command")"
305305
restore_pane_process "$pane_full_command" "$session_name" "$window_number" "$pane_index" "$dir"

0 commit comments

Comments
 (0)