Test suspend code

This commit is contained in:
Zachary Yedidia
2017-05-21 10:30:26 -04:00
parent 285503d009
commit a70fb9db7d
2 changed files with 35 additions and 0 deletions

View File

@@ -837,6 +837,8 @@ func (v *View) Find(usePlugin bool) bool {
return true
}
func (v *View) Suspend(usePlugin bool) bool { return false }
// FindNext searches forwards for the last used search term
func (v *View) FindNext(usePlugin bool) bool {
if usePlugin && !PreActionCall("FindNext", v) {

View File

@@ -0,0 +1,33 @@
package main
import "syscall"
func (v *View) Suspend(usePlugin bool) bool {
if usePlugin && !PreActionCall("Suspend", v) {
return false
}
screenWasNil := screen == nil
if !screenWasNil {
screen.Fini()
screen = nil
}
// suspend the process
pid := syscall.Getpid()
tid := syscall.Gettid()
err := syscall.Tgkill(pid, tid, syscall.SIGSTOP)
if err != nil {
panic(err)
}
if !screenWasNil {
InitScreen()
}
if usePlugin {
return PostActionCall("Suspend", v)
}
return true
}