mirror of https://github.com/Hilbis/Hilbish
fix: stop jobs on exit
parent
db6817e4ca
commit
fc40bad092
17
main.go
17
main.go
|
@ -221,6 +221,8 @@ input:
|
||||||
}
|
}
|
||||||
fmt.Printf("\u001b[7m∆\u001b[0m" + strings.Repeat(" ", termwidth - 1) + "\r")
|
fmt.Printf("\u001b[7m∆\u001b[0m" + strings.Repeat(" ", termwidth - 1) + "\r")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func continuePrompt(prev string) (string, error) {
|
func continuePrompt(prev string) (string, error) {
|
||||||
|
@ -296,10 +298,17 @@ func contains(s []string, e string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func exit(code int) {
|
func exit(code int) {
|
||||||
// wait for all timers to finish before exiting
|
jobs.stopAll()
|
||||||
for {
|
|
||||||
if timers.running == 0 {
|
// wait for all timers to finish before exiting.
|
||||||
os.Exit(code)
|
// only do that when not interactive
|
||||||
|
if !interactive {
|
||||||
|
for {
|
||||||
|
if timers.running == 0 {
|
||||||
|
os.Exit(code)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os.Exit(code)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue