@@ -77,10 +77,10 @@ class SocketCustomLintServerToClientChannel {
7777 final CustomLintServer _server;
7878 final PluginVersionCheckParams _version;
7979 final ServerSocket _serverSocket;
80- late final Future <Process ?> _processFuture;
8180 final CustomLintWorkspace _workspace;
8281
8382 AnalysisSetContextRootsParams _contextRoots;
83+ Future <Process ?>? _processFuture;
8484
8585 late final Stream <CustomLintMessage > _messages = _channel.messages
8686 .map ((e) => e! as Map <String , Object ?>)
@@ -258,6 +258,13 @@ void main(List<String> args) async {
258258 ),
259259 );
260260
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+
261268 await _channel.sendJson (request.toJson ());
262269
263270 final response = await matchingResponse;
@@ -296,11 +303,12 @@ void main(List<String> args) async {
296303 _socket.then ((value) => value.close ()),
297304 _serverSocket.close (),
298305 _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+ ),
304312 ]);
305313 }
306314}
0 commit comments