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

Unified Diff: chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host

Issue 768373004: Improve native messaging documentation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move native messaging docs to new page Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host
diff --git a/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host b/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host
index 89da1c07373ccd1e7042e27f92e54f6b9678f685..8c94ed85c052cfe2da0d68f0bb2d823810600d08 100755
--- a/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host
+++ b/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host
@@ -17,6 +17,13 @@ try:
except ImportError:
Tkinter = None
+# On Windows, the default I/O mode is O_TEXT. Set this to O_BINARY
+# to avoid unwanted modifications of the input/output streams.
+if sys.platform == "win32":
+ import os, msvcrt
+ msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
# Helper function that sends a message to the webapp.
def send_message(message):
# Write message size.

Powered by Google App Engine
This is Rietveld 408576698