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

Side by Side Diff: runtime/bin/file_macos.cc

Issue 2204953002: Don't close stdio/stderr when shutting down. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comment. Created 4 years, 4 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
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_win.cc » ('j') | 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 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <copyfile.h> // NOLINT 10 #include <copyfile.h> // NOLINT
(...skipping 23 matching lines...) Expand all
34 void set_fd(int fd) { fd_ = fd; } 34 void set_fd(int fd) { fd_ = fd; }
35 35
36 private: 36 private:
37 int fd_; 37 int fd_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(FileHandle); 39 DISALLOW_COPY_AND_ASSIGN(FileHandle);
40 }; 40 };
41 41
42 42
43 File::~File() { 43 File::~File() {
44 if (!IsClosed()) { 44 if (!IsClosed() &&
45 handle_->fd() != STDOUT_FILENO && handle_->fd() != STDERR_FILENO) {
45 Close(); 46 Close();
46 } 47 }
47 delete handle_; 48 delete handle_;
48 } 49 }
49 50
50 51
51 void File::Close() { 52 void File::Close() {
52 ASSERT(handle_->fd() >= 0); 53 ASSERT(handle_->fd() >= 0);
53 if (handle_->fd() == STDOUT_FILENO) { 54 if (handle_->fd() == STDOUT_FILENO) {
54 // If stdout, redirect fd to /dev/null. 55 // If stdout, redirect fd to /dev/null.
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 return ((file_1_info.st_ino == file_2_info.st_ino) && 483 return ((file_1_info.st_ino == file_2_info.st_ino) &&
483 (file_1_info.st_dev == file_2_info.st_dev)) ? 484 (file_1_info.st_dev == file_2_info.st_dev)) ?
484 File::kIdentical : 485 File::kIdentical :
485 File::kDifferent; 486 File::kDifferent;
486 } 487 }
487 488
488 } // namespace bin 489 } // namespace bin
489 } // namespace dart 490 } // namespace dart
490 491
491 #endif // defined(TARGET_OS_MACOS) 492 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698