Skip to content

Commit 4cdcbba

Browse files
Made sure ffmpeg is killed even if the program has crashed.
1 parent 4c94452 commit 4cdcbba

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ ________/\\\\\\\\\__________________________________________________________
271271
____\////\\\\\\\\\_\//\\\\\\\\/\\_\/\\\____________\//\\\\\___\/\\\_________
272272
_______\/////////___\////////\//__\///______________\/////____\///__________
273273
274-
v1.0.0-beta
274+
v1.0.1-beta
275275
276276
`)
277277
fmt.Println("Open config file by passing the --config flag")

recscreen.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os/exec"
66
"path/filepath"
77
"strconv"
8+
89
"strings"
910
"time"
1011

@@ -100,6 +101,13 @@ func RecordDisplay() {
100101
return
101102
}
102103

104+
defer func() {
105+
if r := recover(); r != nil {
106+
fmt.Println("\nUnexpected error:", r)
107+
}
108+
exec.Command("taskkill", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid)).Run()
109+
}()
110+
103111
var modkeys []hotkey.Modifier
104112
pressedKeys := map[string]bool{}
105113
for _, key := range config.HotkeyConfig.Modkeys {

0 commit comments

Comments
 (0)