Skip to content

Commit 832b096

Browse files
authored
Force quit frontend server after one second, unskip tests (#1387)
Fixes #1386 Fixes #1383
1 parent d8ed783 commit 832b096

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

frontend_server_client/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.1.2
2+
3+
- Force kill the frontend server after one second when calling shutdown. It
4+
appears to hang on windows sometimes.
5+
16
## 2.1.1
27

38
- Fix a bug where spaces in the output dill path would cause a parse error when

frontend_server_client/lib/src/frontend_server_client.dart

+6-3
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,13 @@ class FrontendServerClient {
295295
}
296296

297297
/// Stop the service gracefully (using the shutdown command)
298-
Future<int> shutdown() {
299-
_feServerStdoutLines.cancel();
298+
Future<int> shutdown() async {
300299
_sendCommand('quit');
301-
return _feServer.exitCode;
300+
var timer = Timer(const Duration(seconds: 1), _feServer.kill);
301+
var exitCode = await _feServer.exitCode;
302+
timer.cancel();
303+
await _feServerStdoutLines.cancel();
304+
return exitCode;
302305
}
303306

304307
/// Kills the server forcefully by calling `kill` on the process, and

frontend_server_client/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: frontend_server_client
2-
version: 2.1.1
2+
version: 2.1.2
33
description: >-
44
Client code to start and interact with the frontend_server compiler from the
55
Dart SDK.

frontend_server_client/test/frontend_sever_client_test.dart

+2-8
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ String get message => p.join('hello', 'world');
117117

118118
expect(await stdoutLines.next, p.join('goodbye', 'world'));
119119
expect(await process.exitCode, 0);
120-
},
121-
skip: Platform.isWindows
122-
? 'https://github.com/dart-lang/webdev/issues/1383'
123-
: false);
120+
});
124121

125122
test('can handle compile errors and reload fixes', () async {
126123
var entrypoint = p.join(packageRoot, 'bin', 'main.dart');
@@ -187,10 +184,7 @@ String get message => p.join('hello', 'world');
187184

188185
expect(await stdoutLines.next, p.join('goodbye', 'world'));
189186
expect(await process.exitCode, 0);
190-
},
191-
skip: Platform.isWindows
192-
? 'https://github.com/dart-lang/webdev/issues/1383'
193-
: false);
187+
});
194188

195189
test('can compile and recompile a dartdevc app', () async {
196190
var entrypoint =

0 commit comments

Comments
 (0)