diff --git a/utils/pub/curl_client.dart b/utils/pub/curl_client.dart index 22e25dd788e..cd74df95f7c 100644 --- a/utils/pub/curl_client.dart +++ b/utils/pub/curl_client.dart @@ -38,7 +38,6 @@ class CurlClient extends http.BaseClient { return withTempDir((tempDir) { var headerFile = join(tempDir, "curl-headers"); var arguments = _argumentsForRequest(request, headerFile); - log.process(executable, arguments); var process; return startProcess(executable, arguments).then((process_) { process = process_; diff --git a/utils/pub/io.dart b/utils/pub/io.dart index 0611b35df47..51f055e8745 100644 --- a/utils/pub/io.dart +++ b/utils/pub/io.dart @@ -599,7 +599,18 @@ class _OutputStreamConsumer implements StreamConsumer, dynamic> { // the following TODO. var completed = false; var completer = new Completer(); - stream.listen((data) => _outputStream.write(data), onDone: () { + stream.listen((data) { + // Writing empty data to a closed stream can cause errors. + if (data.isEmpty) return; + + // TODO(nweiz): remove this try/catch when issue 7836 is fixed. + try { + _outputStream.write(data); + } catch (e, stack) { + if (!completed) completer.completeError(e, stack); + completed = true; + } + }, onDone: () { _outputStream.close(); // TODO(nweiz): wait until _outputStream.onClosed is called once issue // 7761 is fixed.