1 parent
ec330c1bc5
commit
6ca07b1bfc
3 files changed
+26
-9
No files matched your search
@@ -49,8 +49,7 @@ func newApp(ui *ui, nav *nav) *app {
|
||||
case os.Interrupt:
|
||||
return
|
||||
case syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM:
|
||||
app.writeHistory()
|
||||
os.Remove(gLogPath)
|
||||
app.quit()
|
||||
os.Exit(3)
|
||||
return
|
||||
}
|
||||
@@ -59,6 +58,16 @@ func newApp(ui *ui, nav *nav) *app {
|
||||
return app
|
||||
}
|
||||
|
||||
func (app *app) quit() {
|
||||
if err := remote(fmt.Sprintf("drop %d", gClientID)); err != nil {
|
||||
log.Printf("dropping connection: %s", err)
|
||||
}
|
||||
if err := app.writeHistory(); err != nil {
|
||||
log.Printf("writing history file: %s", err)
|
||||
}
|
||||
os.Remove(gLogPath)
|
||||
}
|
||||
|
||||
func (app *app) readFile(path string) {
|
||||
log.Printf("reading file: %s", path)
|
||||
|
||||
@@ -280,14 +289,12 @@ func (app *app) loop() {
|
||||
continue
|
||||
}
|
||||
|
||||
app.quit()
|
||||
|
||||
app.nav.previewChan <- ""
|
||||
|
||||
log.Print("bye!")
|
||||
|
||||
if err := app.writeHistory(); err != nil {
|
||||
log.Printf("writing history file: %s", err)
|
||||
}
|
||||
|
||||
if gLastDirPath != "" {
|
||||
f, err := os.Create(gLastDirPath)
|
||||
if err != nil {
|
||||
@@ -463,8 +470,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
}
|
||||
defer func() {
|
||||
if err := app.ui.resume(); err != nil {
|
||||
app.writeHistory()
|
||||
os.Remove(gLogPath)
|
||||
app.quit()
|
||||
os.Exit(3)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user