mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-09 07:05:08 +02:00
Refactor offline simulation tests so that they reliably set the env variable before ever starting the shell, since we need the env variable to also apply to presaving
This commit is contained in:
@ -105,6 +105,8 @@ func BackupAndRestoreWithId(t testing.TB, id string) func() {
|
||||
touchFile(path.Join(homedir, ".bash_history"))
|
||||
touchFile(path.Join(homedir, ".zsh_history"))
|
||||
touchFile(path.Join(homedir, ".local/share/fish/fish_history"))
|
||||
restoreHishtoryOffline := BackupAndRestoreEnv("HISHTORY_SIMULATE_NETWORK_ERROR")
|
||||
os.Setenv("HISHTORY_SIMULATE_NETWORK_ERROR", "")
|
||||
return func() {
|
||||
cmd := exec.Command("killall", "hishtory", "tmux")
|
||||
stdout, err := cmd.Output()
|
||||
@ -121,6 +123,7 @@ func BackupAndRestoreWithId(t testing.TB, id string) func() {
|
||||
checkError(copy(getBackPath(file, id), file))
|
||||
}
|
||||
checkError(os.Chdir(initialWd))
|
||||
restoreHishtoryOffline()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user