Skip to content

Commit 15cabbb

Browse files
committed
Fixes for cmdline save/restore strategy
1 parent edd8132 commit 15cabbb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

save_command_strategies/cmdline.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exit_safely_if_empty_ppid() {
1313

1414
full_command() {
1515
[[ -z "$CPID" ]] && exit 0
16-
base64 /proc/${CPID}/cmdline
16+
cat /proc/${CPID}/cmdline | perl -ne 'print join(" ", map quotemeta, split(/\000/))' | base64 -w0
1717
}
1818

1919
main() {

scripts/restore.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,14 @@ restore_shell_history() {
293293

294294
restore_all_pane_processes() {
295295
if restore_pane_processes_enabled; then
296+
local save_command_strategy="$(get_tmux_option "$save_command_strategy_option" "$default_save_command_strategy")"
296297
local pane_full_command
297298
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $11 !~ "^:$" { print $2, $3, $7, $8, $11; }' $(last_resurrect_file) |
298299
while IFS=$d read session_name window_number pane_index dir pane_full_command; do
299300
dir="$(remove_first_char "$dir")"
300301
pane_full_command="$(remove_first_char "$pane_full_command")"
301-
if base64 -d <<< $pane_full_command >/dev/null 2>&1; then
302-
pane_full_command=$(base64 -d <<< $pane_full_command | perl -ne 'print join(" ", map quotemeta, split(/\000/)), "\n"')
302+
if [ $save_command_strategy = "cmdline" ]; then
303+
pane_full_command=$(base64 -d <<< $pane_full_command)
303304
fi
304305
restore_pane_process "$pane_full_command" "$session_name" "$window_number" "$pane_index" "$dir"
305306
done

0 commit comments

Comments
 (0)