Skip to content

Commit 593a6e9

Browse files
authored
Merge pull request #110 from dart-lang/pub-window-fix
Fix starting the daemon client on Windows
2 parents 2f4ec88 + 798242a commit 593a6e9

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

webdev/lib/src/serve/daemon_client.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ import 'package:webdev/src/util.dart';
1313
Future<BuildDaemonClient> connectClient(
1414
String workingDirectory, List<String> options) =>
1515
BuildDaemonClient.connect(
16-
workingDirectory,
17-
[pubPath, 'run', 'build_runner', 'daemon']..addAll(options),
18-
);
16+
workingDirectory,
17+
// On Windows we need to call the snapshot directly otherwise
18+
// the process will start in a disjoint cmd without access to
19+
// STDIO.
20+
(Platform.isWindows ? [dartPath, pubSnapshot] : ['pub'])
21+
..addAll(['run', 'build_runner', 'daemon'])
22+
..addAll(options));
1923

2024
/// Returns the port of the daemon asset server.
2125
int daemonPort(String workingDirectory) {

webdev/lib/src/util.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ final String _sdkDir = (() {
1818
})();
1919

2020
final String dartPath = p.join(_sdkDir, 'bin', 'dart');
21+
final String pubSnapshot =
22+
p.join(_sdkDir, 'bin', 'snapshots', 'pub.dart.snapshot');
2123
final String pubPath =
2224
p.join(_sdkDir, 'bin', Platform.isWindows ? 'pub.bat' : 'pub');

webdev/test/e2e_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ void main() {
9797

9898
group('should serve with valid configuration', () {
9999
for (var command in ['serve', 'serve2']) {
100-
if (command == 'serve2' && Platform.isWindows) return;
101100
for (var withDDC in [true, false]) {
102101
var type = withDDC ? 'DDC' : 'dart2js';
103102
var name = 'using $command with $type';

0 commit comments

Comments
 (0)