Visitar URL original
[pigeon] Fix on Windows by creativecreatorormaybenot · Pull Request #216 · flutter/packages · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix pigeon on Windows
  • Loading branch information
creativecreatorormaybenot committed Oct 5, 2020
commit aa0c6ad0f27b023aa2c3b97d34f4b1e9fb0fe414
4 changes: 4 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.10

* Fixed bug that prevented running `pigeon` on Windows (introduced in `0.1.8`).

## 0.1.9

* Fixed bug where executing pigeon without arguments would crash (introduced in 0.1.8).
Expand Down
15 changes: 12 additions & 3 deletions packages/pigeon/bin/pigeon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:io';
import 'dart:isolate';

import 'package:path/path.dart' as path;
import 'package:pigeon/pigeon_lib.dart';

Expand All @@ -28,10 +29,18 @@ void main(List<String> args, SendPort sendPort) async {
sendPort.send(await Pigeon.run(args));
}
""";
final String tempFilename = path.join(tempDir.path, '_pigeon_temp_.dart');
await File(tempFilename).writeAsString(code);

final File tempFile = File(path.join(tempDir.path, '_pigeon_temp_.dart'));
await tempFile.writeAsString(code);
final ReceivePort receivePort = ReceivePort();
Isolate.spawnUri(Uri.parse(tempFilename), args, receivePort.sendPort);
Isolate.spawnUri(
// Using Uri.file instead of Uri.parse in order to parse backslashes as
// path segment separator with Windows semantics.
Uri.file(tempFile.path),
args,
receivePort.sendPort,
);

final Completer<int> completer = Completer<int>();
receivePort.listen((dynamic message) {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pigeon
version: 0.1.9
version: 0.1.10
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
homepage: https://github.com/flutter/packages/tree/master/packages/pigeon
dependencies:
Expand All @@ -8,4 +8,4 @@ dependencies:
dev_dependencies:
test: ^1.11.1
environment:
sdk: '>=2.2.0 <3.0.0'
sdk: '>=2.2.0 <3.0.0'