diff --git a/compiler/main.nim b/compiler/main.nim index ce08eaa303..053783d9bc 100755 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -559,6 +559,7 @@ proc MainCommand = wantMainModule() CommandSuggest() of "serve": + isServing = true gGlobalOptions.incl(optCaasEnabled) msgs.gErrorMax = high(int) # do not stop after first error serve(MainCommand) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 0f2affc366..bec30388cc 100755 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -523,8 +523,8 @@ proc SuggestWriteln*(s: string) = stdoutSocket.send(s & "\c\L") proc SuggestQuit*() = - if isNil(stdoutSocket): quit(0) - else: + if not isServing: quit(0) + elif not isNil(stdoutSocket): stdoutSocket.send("\c\L") raise newException(ESuggestDone, "suggest done") diff --git a/compiler/options.nim b/compiler/options.nim index e809c4e968..ad7c834dc3 100755 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -105,6 +105,7 @@ var gEvalExpr* = "" # expression for idetools --eval gLastCmdTime*: float # when caas is enabled, we measure each command gListFullPaths*: bool + isServing*: bool = false proc importantComments*(): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools} proc usesNativeGC*(): bool {.inline.} = gSelectedGC >= gcRefc diff --git a/compiler/service.nim b/compiler/service.nim index defdbceb72..eaf3693ce3 100644 --- a/compiler/service.nim +++ b/compiler/service.nim @@ -90,4 +90,3 @@ proc serve*(action: proc (){.nimcall.}) = else: echo "Invalid server.type:", typ quit 1 -