@@ -77,10 +77,10 @@ class SocketCustomLintServerToClientChannel {
77
77
final CustomLintServer _server;
78
78
final PluginVersionCheckParams _version;
79
79
final ServerSocket _serverSocket;
80
- late final Future <Process ?> _processFuture;
81
80
final CustomLintWorkspace _workspace;
82
81
83
82
AnalysisSetContextRootsParams _contextRoots;
83
+ Future <Process ?>? _processFuture;
84
84
85
85
late final Stream <CustomLintMessage > _messages = _channel.messages
86
86
.map ((e) => e! as Map <String , Object ?>)
@@ -258,6 +258,13 @@ void main(List<String> args) async {
258
258
),
259
259
);
260
260
261
+ // Drop all request if process not ready yet
262
+ // Because request will never got response and wait forever
263
+ if (request is CustomLintRequestAnalyzerPluginRequest &&
264
+ (_processFuture == null || await _processFuture == null )) {
265
+ return CustomLintResponseAnalyzerPluginResponse (Response ('' , 0 ), id: '' );
266
+ }
267
+
261
268
await _channel.sendJson (request.toJson ());
262
269
263
270
final response = await matchingResponse;
@@ -296,11 +303,12 @@ void main(List<String> args) async {
296
303
_socket.then ((value) => value.close ()),
297
304
_serverSocket.close (),
298
305
_channel.close (),
299
- _processFuture.then <void >(
300
- (value) => value? .kill (),
301
- // The process wasn't started. No need to do anything.
302
- onError: (_) {},
303
- ),
306
+ if (_processFuture != null )
307
+ _processFuture! .then <void >(
308
+ (value) => value? .kill (),
309
+ // The process wasn't started. No need to do anything.
310
+ onError: (_) {},
311
+ ),
304
312
]);
305
313
}
306
314
}
0 commit comments