Skip to content

Commit 2760510

Browse files
committed
Added safety check
1 parent e7e8e59 commit 2760510

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: main.go

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os/signal"
1313
"os/user"
1414
"path"
15+
"strings"
1516

1617
"github.com/arduino/arduino-language-server/ls"
1718
"github.com/arduino/arduino-language-server/streams"
@@ -22,6 +23,12 @@ import (
2223
func main() {
2324
if len(os.Args) > 1 && os.Args[1] == "remove-temp-files" {
2425
for _, tmpFile := range os.Args[2:] {
26+
// SAFETY CHECK
27+
if !strings.Contains(tmpFile, "arduino-language-server") {
28+
fmt.Println("Could not remove extraneous temp folder:", tmpFile)
29+
os.Exit(1)
30+
}
31+
2532
paths.New(tmpFile).RemoveAll()
2633
}
2734
return

0 commit comments

Comments
 (0)