2018-08-27 19:53:10 +00:00
|
|
|
// +build linux darwin dragonfly solaris openbsd netbsd freebsd
|
|
|
|
|
|
2018-08-27 23:53:08 +00:00
|
|
|
package action
|
2018-08-27 19:53:10 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"syscall"
|
|
|
|
|
|
2020-05-04 14:16:15 +00:00
|
|
|
"github.com/zyedidia/micro/v2/internal/screen"
|
2018-08-27 19:53:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Suspend sends micro to the background. This is the same as pressing CtrlZ in most unix programs.
|
|
|
|
|
// This only works on linux and has no default binding.
|
|
|
|
|
// This code was adapted from the suspend code in nsf/godit
|
2019-01-19 20:37:59 +00:00
|
|
|
func (*BufPane) Suspend() bool {
|
2019-01-10 21:37:05 +00:00
|
|
|
screenb := screen.TempFini()
|
2018-08-27 19:53:10 +00:00
|
|
|
|
|
|
|
|
// suspend the process
|
|
|
|
|
pid := syscall.Getpid()
|
|
|
|
|
err := syscall.Kill(pid, syscall.SIGSTOP)
|
|
|
|
|
if err != nil {
|
2019-01-14 02:06:58 +00:00
|
|
|
screen.TermMessage(err)
|
2018-08-27 19:53:10 +00:00
|
|
|
}
|
|
|
|
|
|
2019-01-10 21:37:05 +00:00
|
|
|
screen.TempStart(screenb)
|
2018-08-27 19:53:10 +00:00
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|