Skip to content

Commit 409b2e1

Browse files
authored
Prevent SIGSEGV when shutting down nimsuggest processes (#377)
* Add exe files to gitignore. * Fix typo. * Add a guard that prevents attempts to shut down non-existent processes.
1 parent 1db5dfa commit 409b2e1

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
nimcache/
44

55
*.log
6+
*.exe
67
tests/all
78
/nimlangserver
89
nimble.develop

lstransports.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ proc startStdioLoop*(ls: LanguageServer): Future[void] {.async.} =
246246
freeShared(ls.stdinContext.value[0].addr)
247247
await ls.stdinContext.onMainReadSignal.fire()
248248
if msg == "":
249-
error "Client discconected"
249+
error "Client disconnected"
250250
break
251251
ls.processMessage(msg)
252252

suggestapi.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ proc markFailed(self: Project, errMessage: string) {.raises: [].} =
268268

269269
proc stop*(self: Project) =
270270
debug "Stopping nimsuggest for ", root = self.file
271-
asyncSpawn shutdownChildProcess(self.process)
271+
if not self.process.isNil:
272+
asyncSpawn shutdownChildProcess(self.process)
272273

273274
proc doWithTimeout*[T](fut: Future[T], timeout: int, s: string): owned(Future[bool]) =
274275
var retFuture = newFuture[bool]("asyncdispatch.`doWithTimeout`")

0 commit comments

Comments
 (0)