diff --git a/dev/update_packages.dart b/dev/update_packages.dart index c72350bf59..a8a9a0f8d1 100755 --- a/dev/update_packages.dart +++ b/dev/update_packages.dart @@ -10,7 +10,12 @@ update(Directory directory) { for (FileSystemEntity dir in directory.listSync()) { if (dir is Directory) { print("Updating ${dir.path}..."); - Process.runSync(binaryName, ['get'], workingDirectory: dir.path); + ProcessResult result = Process.runSync(binaryName, ['get'], workingDirectory: dir.path); + if (result.exitCode != 0) { + print("... failed with exit code ${result.exitCode}."); + print(result.stdout); + print(result.stderr); + } } } } diff --git a/packages/flutter_tools/lib/src/commands/apk.dart b/packages/flutter_tools/lib/src/commands/apk.dart index 569ed4e250..7e3ac6ab4d 100644 --- a/packages/flutter_tools/lib/src/commands/apk.dart +++ b/packages/flutter_tools/lib/src/commands/apk.dart @@ -172,11 +172,11 @@ class ApkCommand extends FlutterCommand { components.keystore = new File(artifactPaths[3]); if (!components.androidSdk.existsSync()) { - _logging.severe('Can not locate Android SDK: ${androidSdkPath}'); + _logging.severe('Can not locate Android SDK: $androidSdkPath'); return null; } if (!(new _ApkBuilder(components.androidSdk.path).checkSdkPath())) { - _logging.severe('Can not locate expected Android SDK tools at ${androidSdkPath}'); + _logging.severe('Can not locate expected Android SDK tools at $androidSdkPath'); _logging.severe('You must install version $_kAndroidPlatformVersion of the SDK platform'); _logging.severe('and version $_kBuildToolsVersion of the build tools.'); return null; diff --git a/packages/updater/lib/main.dart b/packages/updater/lib/main.dart index a14eb67c11..4f748f6e44 100644 --- a/packages/updater/lib/main.dart +++ b/packages/updater/lib/main.dart @@ -98,8 +98,8 @@ class UpdateTask { _tempPath = path.join(_dataDir, 'tmp.skyx'); String bundleUrl = _currentManifest['update-url'] + '/' + kBundleFile; UrlResponse response = await fetchUrl(bundleUrl); - MojoResult result = await PipeToFile.copyToFile(response.body, _tempPath); - if (!result.isOk) + int result = await PipeToFile.copyToFile(response.body, _tempPath); + if (result != MojoResult.kOk) throw new UpdateFailure('Failure fetching new package: ${response.statusLine}'); } diff --git a/packages/updater/lib/pipe_to_file.dart b/packages/updater/lib/pipe_to_file.dart index cf307fe952..1baaac6117 100644 --- a/packages/updater/lib/pipe_to_file.dart +++ b/packages/updater/lib/pipe_to_file.dart @@ -11,15 +11,15 @@ import 'package:mojo/core.dart'; // Helper class to drain the contents of a mojo data pipe to a file. class PipeToFile { MojoDataPipeConsumer _consumer; - MojoEventSubscription _eventStream; + MojoEventSubscription _events; IOSink _outputStream; PipeToFile(this._consumer, String outputPath) { - _eventStream = new MojoEventSubscription(_consumer.handle); + _events = new MojoEventSubscription(_consumer.handle); _outputStream = new File(outputPath).openWrite(); } - Future _doRead() async { + Future _doRead() async { ByteData thisRead = _consumer.beginRead(); if (thisRead == null) { throw 'Data pipe beginRead failed: ${_consumer.status}'; @@ -30,34 +30,34 @@ class PipeToFile { return _consumer.endRead(thisRead.lengthInBytes); } - Future drain() async { - Completer completer = new Completer(); - // TODO(mpcomplete): Is it legit to pass an async callback to listen? - _eventStream.subscribe((List event) async { - MojoHandleSignals mojoSignals = new MojoHandleSignals(event[1]); - if (mojoSignals.isReadable) { - MojoResult result = await _doRead(); - if (!result.isOk) { - _eventStream.close(); - _eventStream = null; + Future drain() { + Completer completer = new Completer(); + // TODO(mpcomplete): Is it legit to pass an async callback to subscribe? + _events.subscribe((List event) async { + int signal = event[1]; + if (MojoHandleSignals.isReadable(signal)) { + int result = await _doRead(); + if (result != MojoResult.kOk) { + _events.close(); + _events = null; _outputStream.close(); completer.complete(result); } else { - _eventStream.enableReadEvents(); + _events.enableReadEvents(); } - } else if (mojoSignals.isPeerClosed) { - _eventStream.close(); - _eventStream = null; + } else if (MojoHandleSignals.isPeerClosed(signal)) { + _events.close(); + _events = null; _outputStream.close(); - completer.complete(MojoResult.OK); + completer.complete(MojoResult.kOk); } else { - throw 'Unexpected handle event: $mojoSignals'; + throw 'Unexpected handle event: ${MojoHandleSignals.string(signal)}'; } }); return completer.future; } - static Future copyToFile(MojoDataPipeConsumer consumer, String outputPath) { + static Future copyToFile(MojoDataPipeConsumer consumer, String outputPath) { PipeToFile drainer = new PipeToFile(consumer, outputPath); return drainer.drain(); }