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

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

Issue 25465002: Always mark stdout as blocking when using 'print'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/platform.h" 8 #include "bin/platform.h"
9 9
10 #include <signal.h> // NOLINT 10 #include <signal.h> // NOLINT
11 #include <string.h> // NOLINT 11 #include <string.h> // NOLINT
12 #include <unistd.h> // NOLINT 12 #include <unistd.h> // NOLINT
13 13
14 #include "bin/fdutils.h"
15
14 16
15 namespace dart { 17 namespace dart {
16 namespace bin { 18 namespace bin {
17 19
18 bool Platform::Initialize() { 20 bool Platform::Initialize() {
19 // Turn off the signal handler for SIGPIPE as it causes the process 21 // Turn off the signal handler for SIGPIPE as it causes the process
20 // to terminate on writing to a closed pipe. Without the signal 22 // to terminate on writing to a closed pipe. Without the signal
21 // handler error EPIPE is set instead. 23 // handler error EPIPE is set instead.
22 struct sigaction act; 24 struct sigaction act;
23 bzero(&act, sizeof(act)); 25 bzero(&act, sizeof(act));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 result[current] = environ[current]; 59 result[current] = environ[current];
58 } 60 }
59 return result; 61 return result;
60 } 62 }
61 63
62 64
63 void Platform::FreeEnvironment(char** env, intptr_t count) { 65 void Platform::FreeEnvironment(char** env, intptr_t count) {
64 delete[] env; 66 delete[] env;
65 } 67 }
66 68
69
70 void Platform::PrintBlocking(FILE* file, const char* format, ...) {
71 int fd = fileno(file);
72 FDUtils::SetBlocking(fd);
73 va_list args;
74 va_start(args, format);
75 vfprintf(file, format, args);
76 fflush(file);
77 va_end(args);
78 FDUtils::SetNonBlocking(fd);
79 }
80
67 } // namespace bin 81 } // namespace bin
68 } // namespace dart 82 } // namespace dart
69 83
70 #endif // defined(TARGET_OS_ANDROID) 84 #endif // defined(TARGET_OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698