Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: utils/pub/io.dart

Issue 11230051: Do *not* make file handles inheritable on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Helper functionality to make working with IO easier. 6 * Helper functionality to make working with IO easier.
7 */ 7 */
8 library io; 8 library io;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 var pathTo7zip = '../../third_party/7zip/7za.exe'; 648 var pathTo7zip = '../../third_party/7zip/7za.exe';
649 var command = scriptDir.append(pathTo7zip).canonicalize().toNativePath(); 649 var command = scriptDir.append(pathTo7zip).canonicalize().toNativePath();
650 650
651 var tempDir; 651 var tempDir;
652 652
653 return createTempDir().chain((temp) { 653 return createTempDir().chain((temp) {
654 // Write the archive to a temp file. 654 // Write the archive to a temp file.
655 tempDir = temp; 655 tempDir = temp;
656 return createFileFromStream(stream, join(tempDir, 'data.tar.gz')); 656 return createFileFromStream(stream, join(tempDir, 'data.tar.gz'));
657 }).chain((_) { 657 }).chain((_) {
658 // TODO(rnystrom): Hack. We get intermittent "file already in use" errors.
659 // It looks like the 7zip process is starting up before the file has
660 // finished being written. So we'll just sleep for a couple of seconds
661 // here. :(
662 return sleep(2000);
663 }).chain((_) {
664 // 7zip can't unarchive from gzip -> tar -> destination all in one step 658 // 7zip can't unarchive from gzip -> tar -> destination all in one step
665 // first we un-gzip it to a tar file. 659 // first we un-gzip it to a tar file.
666 // Note: Setting the working directory instead of passing in a full file 660 // Note: Setting the working directory instead of passing in a full file
667 // path because 7zip says "A full path is not allowed here." 661 // path because 7zip says "A full path is not allowed here."
668 return runProcess(command, ['e', 'data.tar.gz'], workingDir: tempDir); 662 return runProcess(command, ['e', 'data.tar.gz'], workingDir: tempDir);
669 }).chain((result) { 663 }).chain((result) {
670 if (result.exitCode != 0) { 664 if (result.exitCode != 0) {
671 throw 'Could not un-gzip (exit code ${result.exitCode}). Error:\n' 665 throw 'Could not un-gzip (exit code ${result.exitCode}). Error:\n'
672 '${Strings.join(result.stdout, "\n")}\n' 666 '${Strings.join(result.stdout, "\n")}\n'
673 '${Strings.join(result.stderr, "\n")}'; 667 '${Strings.join(result.stderr, "\n")}';
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 return new Directory(entry); 748 return new Directory(entry);
755 } 749 }
756 750
757 /** 751 /**
758 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 752 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
759 */ 753 */
760 Uri _getUri(uri) { 754 Uri _getUri(uri) {
761 if (uri is Uri) return uri; 755 if (uri is Uri) return uri;
762 return new Uri.fromString(uri); 756 return new Uri.fromString(uri);
763 } 757 }
OLDNEW
« no previous file with comments | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698