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

Side by Side Diff: runtime/bin/file_linux.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.cc ('k') | runtime/bin/file_macos.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_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 21 matching lines...) Expand all
32 void set_fd(int fd) { fd_ = fd; } 32 void set_fd(int fd) { fd_ = fd; }
33 33
34 private: 34 private:
35 int fd_; 35 int fd_;
36 36
37 DISALLOW_COPY_AND_ASSIGN(FileHandle); 37 DISALLOW_COPY_AND_ASSIGN(FileHandle);
38 }; 38 };
39 39
40 40
41 File::~File() { 41 File::~File() {
42 if (!IsClosed()) { 42 if (!IsClosed() &&
43 handle_->fd() != STDOUT_FILENO && handle_->fd() != STDERR_FILENO) {
43 Close(); 44 Close();
44 } 45 }
45 delete handle_; 46 delete handle_;
46 } 47 }
47 48
48 49
49 void File::Close() { 50 void File::Close() {
50 ASSERT(handle_->fd() >= 0); 51 ASSERT(handle_->fd() >= 0);
51 if (handle_->fd() == STDOUT_FILENO) { 52 if (handle_->fd() == STDOUT_FILENO) {
52 // If stdout, redirect fd to /dev/null. 53 // If stdout, redirect fd to /dev/null.
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return ((file_1_info.st_ino == file_2_info.st_ino) && 519 return ((file_1_info.st_ino == file_2_info.st_ino) &&
519 (file_1_info.st_dev == file_2_info.st_dev)) ? 520 (file_1_info.st_dev == file_2_info.st_dev)) ?
520 File::kIdentical : 521 File::kIdentical :
521 File::kDifferent; 522 File::kDifferent;
522 } 523 }
523 524
524 } // namespace bin 525 } // namespace bin
525 } // namespace dart 526 } // namespace dart
526 527
527 #endif // defined(TARGET_OS_LINUX) 528 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698