nixd
Loading...
Searching...
No Matches
nixd
lib
Support
StreamProc.cpp
Go to the documentation of this file.
1
#include "
nixd/Support/StreamProc.h
"
2
#include "
nixd/Support/ForkPiped.h
"
3
4
using namespace
nixd
;
5
using namespace
util
;
6
using namespace
lspserver
;
7
8
std::unique_ptr<InboundPort>
StreamProc::mkIn
()
const
{
9
return
std::make_unique<InboundPort>(Proc->Stdout.get(),
10
JSONStreamStyle::Standard
);
11
}
12
13
std::unique_ptr<OutboundPort>
StreamProc::mkOut
()
const
{
14
return
std::make_unique<OutboundPort>(*Stream);
15
}
16
17
StreamProc::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
}
ForkPiped.h
StreamProc.h
lspserver
Whether current platform treats paths case insensitively.
Definition
Connection.h:11
lspserver::JSONStreamStyle::Standard
@ Standard
Definition
Connection.h:15
nixd::util
Definition
AutoCloseFD.h:5
nixd
Definition
CommandLine/Configuration.h:9
nixd::forkPiped
int forkPiped(int &In, int &Out, int &Err)
fork this process and create some pipes connected to the new process.
Definition
ForkPiped.cpp:8
nixd::StreamProc::StreamProc
StreamProc(const std::function< int()> &Action)
Launch a streamed process with Action.
Definition
StreamProc.cpp:17
nixd::StreamProc::mkIn
std::unique_ptr< lspserver::InboundPort > mkIn() const
Definition
StreamProc.cpp:8
nixd::StreamProc::mkOut
std::unique_ptr< lspserver::OutboundPort > mkOut() const
Definition
StreamProc.cpp:13
Generated by
1.13.0