We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12a1bf6 commit a03fc20Copy full SHA for a03fc20
main.go
@@ -8,6 +8,7 @@ import (
8
"os"
9
"os/exec"
10
"path/filepath"
11
+ "runtime/debug"
12
13
"github.com/bcmi-labs/arduino-language-server/handler"
14
"github.com/bcmi-labs/arduino-language-server/streams"
@@ -33,7 +34,13 @@ func main() {
33
34
35
if enableLogging {
36
logfile := openLogFile("inols-err.log")
- defer logfile.Close()
37
+ defer func() {
38
+ // In case of panic output the stack trace in the log file before exiting
39
+ if r := recover(); r != nil {
40
+ log.Println(string(debug.Stack()))
41
+ }
42
+ logfile.Close()
43
+ }()
44
log.SetOutput(logfile)
45
} else {
46
log.SetOutput(os.Stderr)
0 commit comments