nixd
Loading...
Searching...
No Matches
StreamProc.cpp
Go to the documentation of this file.
3
4using namespace nixd;
5using namespace util;
6using namespace lspserver;
7
8std::unique_ptr<InboundPort> StreamProc::mkIn() const {
9 return std::make_unique<InboundPort>(Proc->Stdout.get(),
10 JSONStreamStyle::Standard);
11}
12
13std::unique_ptr<OutboundPort> StreamProc::mkOut() const {
14 return std::make_unique<OutboundPort>(*Stream);
15}
16
17StreamProc::StreamProc(const std::function<int()> &Action) {
18 int In;
19 int Out;
20 int Err;
21
22 pid_t Child = forkPiped(In, Out, Err);
23 if (Child == 0)
24 exit(Action());
25
26 // Parent process.
27 Proc = std::make_unique<PipedProc>(Child, In, Out, Err);
28 Stream = std::make_unique<llvm::raw_fd_ostream>(In, false);
29}
Whether current platform treats paths case insensitively.
Definition Connection.h:11
int forkPiped(int &In, int &Out, int &Err)
fork this process and create some pipes connected to the new process.
Definition ForkPiped.cpp:8
bool fromJSON(const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P)
StreamProc(const std::function< int()> &Action)
Launch a streamed process with Action.
std::unique_ptr< lspserver::InboundPort > mkIn() const
Definition StreamProc.cpp:8
std::unique_ptr< lspserver::OutboundPort > mkOut() const