sqlite-backed shell history

__stinkpot_record: Preserve exit code for following prompt commands #24

Merged oppi.li
targeting main from deleted fork:main
Merged opened by and assigned to oppi.li
targeting main from deleted fork:main

This change makes the bash procedure __stinkpot_record return the exit code of the last user command. This makes it so that commands following it in PROMPT_COMMAND will also be passed the correct exit code.

Before this change a .bashrc with the following contents

function new-prompt { user_exit_code="$?" echo "The last command exited with status: ${user_exit_code}." return $user_exit_code } PROMPT_COMMAND="new-prompt;" eval "$(stinkpot init)"

would produce the unexpected session

rovanion@T14i ~$ true The last command exited with status: 0. rovanion@T14i ~$ false The last command exited with status: 0.

instead of the expected session

rovanion@T14i ~$ true The last command exited with status: 0. rovanion@T14i ~$ false The last command exited with status: 1.

which is what now happens with this patch applied.

Commits 0