summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-02-27 15:53:44 -0800
committerAraq <rumpf_a@web.de>2013-02-27 15:53:44 -0800
commitc0201b8d4a587e5ae84f350b9566e94da2deb0aa (patch)
tree3e0fe8ff25ae5d8895ab02d60f753cfe2c1bdb75 /compiler
parentc5d2e421ce4ec77c080f1d3efb9a44bcda7be4fc (diff)
parentcc893b968b6204622727cf6f9362519752297a0e (diff)
downloadNim-c0201b8d4a587e5ae84f350b9566e94da2deb0aa.tar.gz
Merge pull request #348 from Tass/isServing
added isServing parameter
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/main.nim1
-rwxr-xr-xcompiler/msgs.nim4
-rwxr-xr-xcompiler/options.nim1
-rw-r--r--compiler/service.nim1
4 files changed, 4 insertions, 3 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index ce08eaa30..053783d9b 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 0f2affc36..bec30388c 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 e809c4e96..ad7c834dc 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 defdbceb7..eaf3693ce 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
-