server-mode: Introduce cmServerConnection

Use it to split pipe and stdin/out handling out of cmServer itself.

The server will shut down when it looses its connection to the client.
This has the nice property that a crashing client will cause the server
to terminate as the OS will close the connection on behave of the client.
This commit is contained in:
Tobias Hunger
2016-09-09 10:01:44 +02:00
committed by Brad King
parent 2c2ffd3874
commit 1d601c6cb9
11 changed files with 476 additions and 149 deletions
+9 -4
View File
@@ -49,12 +49,16 @@ Operation
Start :manual:`cmake(1)` in the server command mode, supplying the path to
the build directory to process::
cmake -E server
cmake -E server (--debug|--pipe <NAMED_PIPE>)
The server will start up and reply with an hello message on stdout::
The server will communicate using stdin/stdout (with the ``--debug`` parameter)
or using a named pipe (with the ``--pipe <NAMED_PIPE>`` parameter).
When connecting to the server (via named pipe or by starting it in ``--debug``
mode), the server will reply with a hello message::
[== CMake Server ==[
{"supportedProtocolVersions":[{"major":0,"minor":1}],"type":"hello"}
{"supportedProtocolVersions":[{"major":1,"minor":0}],"type":"hello"}
]== CMake Server ==]
Messages sent to and from the process are wrapped in magic strings::
@@ -65,7 +69,8 @@ Messages sent to and from the process are wrapped in magic strings::
}
]== CMake Server ==]
The server is now ready to accept further requests via stdin.
The server is now ready to accept further requests via the named pipe
or stdin.
Debugging