Fix bug where reading stdin would cause the install to hang

This commit is contained in:
David Dworken 2022-10-16 09:47:26 -07:00
parent f337d7affd
commit d255131d68
2 changed files with 6 additions and 5 deletions

View File

@ -407,11 +407,11 @@ func ImportHistory(ctx *context.Context) (int, error) {
return 0, fmt.Errorf("failed to parse zsh history: %v", err) return 0, fmt.Errorf("failed to parse zsh history: %v", err)
} }
historyEntries = append(historyEntries, extraEntries...) historyEntries = append(historyEntries, extraEntries...)
extraEntries, err = readStdin() // extraEntries, err = readStdin()
if err != nil { // if err != nil {
return 0, fmt.Errorf("failed to read stdin: %v", err) // return 0, fmt.Errorf("failed to read stdin: %v", err)
} // }
historyEntries = append(historyEntries, extraEntries...) // historyEntries = append(historyEntries, extraEntries...)
db := hctx.GetDb(ctx) db := hctx.GetDb(ctx)
currentUser, err := user.Current() currentUser, err := user.Current()
if err != nil { if err != nil {

View File

@ -73,6 +73,7 @@ func main() {
case "install": case "install":
lib.CheckFatalError(lib.Install()) lib.CheckFatalError(lib.Install())
if os.Getenv("HISHTORY_TEST") == "" { if os.Getenv("HISHTORY_TEST") == "" {
fmt.Println("Importing existing shell history...")
ctx := hctx.MakeContext() ctx := hctx.MakeContext()
numImported, err := lib.ImportHistory(ctx) numImported, err := lib.ImportHistory(ctx)
lib.CheckFatalError(err) lib.CheckFatalError(err)