mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-23 14:01:00 +01:00
Add todo, extra debugging output for failing mac test, and a check on resp.StatusCode
This commit is contained in:
parent
97f5368954
commit
1cc36fa0ef
@ -680,7 +680,7 @@ echo hello2
|
|||||||
tester.RunInteractiveShell(t, " echo hidden")
|
tester.RunInteractiveShell(t, " echo hidden")
|
||||||
out := hishtoryQuery(t, tester, "-pipefail")
|
out := hishtoryQuery(t, tester, "-pipefail")
|
||||||
if strings.Count(out, "\n") != 3 {
|
if strings.Count(out, "\n") != 3 {
|
||||||
t.Fatalf("hishtory query has the wrong number of lines=%d, out=%#v", strings.Count(out, "\n"), out)
|
t.Fatalf("hishtory query has the wrong number of lines=%d, out=%#v, bash hishtory file=%#v", strings.Count(out, "\n"), out, tester.RunInteractiveShell(t, "cat ~/.bash_history"))
|
||||||
}
|
}
|
||||||
if strings.Count(out, "echo hello") != 2 {
|
if strings.Count(out, "echo hello") != 2 {
|
||||||
t.Fatalf("hishtory query has the wrong number of commands=%d, out=%#v", strings.Count(out, "echo mycommand"), out)
|
t.Fatalf("hishtory query has the wrong number of commands=%d, out=%#v", strings.Count(out, "echo mycommand"), out)
|
||||||
@ -702,6 +702,8 @@ echo hello2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Timestamps for bash on macos appear to be currently broken, debug this. Example: https://github.com/ddworken/hishtory/runs/6059464342?check_suite_focus=true
|
||||||
|
|
||||||
func getPidofCommand() string {
|
func getPidofCommand() string {
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// MacOS doesn't have pidof by default
|
// MacOS doesn't have pidof by default
|
||||||
|
@ -552,6 +552,9 @@ func downloadFile(filename, url string) error {
|
|||||||
return fmt.Errorf("failed to download file at %s to %s: %v", url, filename, err)
|
return fmt.Errorf("failed to download file at %s to %s: %v", url, filename, err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
return fmt.Errorf("failed to download file at %s due to resp_code=%d", url, resp.StatusCode)
|
||||||
|
}
|
||||||
|
|
||||||
out, err := os.Create(filename)
|
out, err := os.Create(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -560,6 +563,7 @@ func downloadFile(filename, url string) error {
|
|||||||
defer out.Close()
|
defer out.Close()
|
||||||
|
|
||||||
_, err = io.Copy(out, resp.Body)
|
_, err = io.Copy(out, resp.Body)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user