File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -159,10 +159,12 @@ struct Main: ParsableCommand {
159
159
fatalError ( " failed to redirect stdout -> stderr: \( strerror ( errno) !) " )
160
160
}
161
161
162
+ let realStdoutHandle = FileHandle ( fileDescriptor: realStdout, closeOnDealloc: false )
163
+
162
164
let clientConnection = JSONRPCConnection (
163
165
protocol: MessageRegistry . lspProtocol,
164
166
inFD: FileHandle . standardInput,
165
- outFD: FileHandle ( fileDescriptor : realStdout , closeOnDealloc : false ) ,
167
+ outFD: realStdoutHandle ,
166
168
syncRequests: syncRequests
167
169
)
168
170
@@ -174,6 +176,9 @@ struct Main: ParsableCommand {
174
176
} )
175
177
clientConnection. start ( receiveHandler: server, closeHandler: {
176
178
server. prepareForExit ( )
179
+ // FIXME: keep the FileHandle alive until we close the connection to
180
+ // workaround SR-13822.
181
+ withExtendedLifetime ( realStdoutHandle) { }
177
182
// Use _Exit to avoid running static destructors due to SR-12668.
178
183
_Exit ( 0 )
179
184
} )
You can’t perform that action at this time.
0 commit comments