Improve stdout/stderr silencing from #260 and #253 (#273)

* Improve stdout/stderr silencing from #260 and #253

* Fix order of output redirection

* Update goldens
This commit is contained in:
David Dworken 2024-12-31 18:06:11 -05:00 committed by GitHub
parent 023323ea81
commit 0de38fac95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 5 deletions

View File

@ -6,7 +6,7 @@ function _hishtory_post_exec --on-event fish_preexec
# Runs after <ENTER>, but before the command is executed # Runs after <ENTER>, but before the command is executed
set --global _hishtory_command $argv set --global _hishtory_command $argv
set --global _hishtory_start_time (hishtory getTimestamp) set --global _hishtory_start_time (hishtory getTimestamp)
hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time &; disown 2>&1 >/dev/null # Background Run hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null &; disown # Background Run
# hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run # hishtory presaveHistoryEntry fish "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
end end
@ -19,9 +19,9 @@ function __hishtory_on_prompt --on-event fish_prompt
if [ -n "$_hishtory_first_prompt" ] if [ -n "$_hishtory_first_prompt" ]
set --global -e _hishtory_first_prompt set --global -e _hishtory_first_prompt
else if [ -n "$_hishtory_command" ] else if [ -n "$_hishtory_command" ]
hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &; disown 2>&1 >/dev/null # Background Run hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null &; disown # Background Run
# hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run # hishtory saveHistoryEntry fish $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
hishtory updateLocalDbFromRemote &; disown hishtory updateLocalDbFromRemote 2>&1 >/dev/null &; disown
set --global -e _hishtory_command # Unset _hishtory_command so we don't double-save entries when fish_prompt is invoked but fish_postexec isn't set --global -e _hishtory_command # Unset _hishtory_command so we don't double-save entries when fish_prompt is invoked but fish_postexec isn't
end end
end end

View File

@ -56,7 +56,7 @@ function __hishtory_postcommand() {
LAST_SAVED_COMMAND=$CMD LAST_SAVED_COMMAND=$CMD
(hishtory updateLocalDbFromRemote &) (hishtory updateLocalDbFromRemote &) 2>&1 >/dev/null
return $EXIT_CODE return $EXIT_CODE
} }

View File

@ -29,7 +29,7 @@ function _hishtory_precmd() {
fi fi
(hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &) 2>&1 >/dev/null # Background Run (hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &) 2>&1 >/dev/null # Background Run
# hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run # hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time 2>&1 >/dev/null # Foreground Run
(hishtory updateLocalDbFromRemote &) (hishtory updateLocalDbFromRemote &) 2>&1 >/dev/null
} }
_hishtory_widget() { _hishtory_widget() {

View File

@ -1,3 +1,4 @@
Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter. Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter.
Feedback: Successfully uninstalled hishtory, please restart your terminal... Feedback: Successfully uninstalled hishtory, please restart your terminal...
bash: /home/runner/.hishtory/hishtory: No such file or directory bash: /home/runner/.hishtory/hishtory: No such file or directory
bash: /home/runner/.hishtory/hishtory: No such file or directory

View File

@ -1,3 +1,4 @@
Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter. Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]Do you have any feedback on why you're uninstallying hiSHtory? Type any feedback and then hit enter.
Feedback: Successfully uninstalled hishtory, please restart your terminal... Feedback: Successfully uninstalled hishtory, please restart your terminal...
_hishtory_precmd:8: command not found: hishtory _hishtory_precmd:8: command not found: hishtory
_hishtory_precmd:9: command not found: hishtory