| 1 |
//go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd |
| 2 |
|
| 3 |
package action |
| 4 |
|
| 5 |
import ( |
| 6 |
"syscall" |
| 7 |
|
| 8 |
"github.com/zyedidia/micro/v2/internal/screen" |
| 9 |
) |
| 10 |
|
| 11 |
// Suspend sends micro to the background. This is the same as pressing CtrlZ in most unix programs. |
| 12 |
// This only works on linux and has no default binding. |
| 13 |
// This code was adapted from the suspend code in nsf/godit |
| 14 |
func (*BufPane) Suspend() bool { |
| 15 |
screenb := screen.TempFini() |
| 16 |
|
| 17 |
// suspend the process |
| 18 |
pid := syscall.Getpid() |
| 19 |
err := syscall.Kill(pid, syscall.SIGSTOP) |
| 20 |
if err != nil { |
| 21 |
screen.TermMessage(err) |
| 22 |
} |
| 23 |
|
| 24 |
screen.TempStart(screenb) |
| 25 |
|
| 26 |
return false |
| 27 |
} |