[pigeon] Fix on Windows (#216)

This commit is contained in:
creativecreatorormaybenot
2020-10-06 16:29:07 +00:00
committed by GitHub
parent 97c16d5c72
commit 4e11063109
4 changed files with 19 additions and 6 deletions

View File

@ -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).

View File

@ -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';
@ -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 {

View File

@ -8,7 +8,7 @@ import 'dart:mirrors';
import 'ast.dart';
/// The current version of pigeon.
const String pigeonVersion = '0.1.9';
const String pigeonVersion = '0.1.10';
/// Read all the content from [stdin] to a String.
String readStdin() {

View File

@ -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:
@ -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'