From 2e896a45bafe8a122e805ea357b35b203e4821dd Mon Sep 17 00:00:00 2001
From: Todd Eisenberger <teisenbe@google.com>
Date: Tue, 26 Mar 2019 22:49:35 +0000
Subject: [PATCH] [devhost] Make stdout claim to be a TTY

This enables line buffering, which folks were relying on for debugging.

MA-573 #done

Change-Id: I03c522eeab2cb5ceec8ff3459dc418d82b0a8c03
---
 zircon/system/core/devmgr/devhost/devhost.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/zircon/system/core/devmgr/devhost/devhost.cpp b/zircon/system/core/devmgr/devhost/devhost.cpp
index d2379ceecf2..eccc4c219f7 100644
--- a/zircon/system/core/devmgr/devhost/devhost.cpp
+++ b/zircon/system/core/devmgr/devhost/devhost.cpp
@@ -922,9 +922,16 @@ static zx_status_t devhost_log_write(zxio_t* io, const void* buffer, size_t capa
     return ZX_OK;
 }
 
+static zx_status_t devhost_log_isatty(zxio_t* io, bool* tty) {
+    // Claim to be a TTY to get line buffering
+    *tty = true;
+    return ZX_OK;
+}
+
 static constexpr zxio_ops_t devhost_log_ops = []() {
     zxio_ops_t ops = zxio_default_ops;
     ops.write = devhost_log_write;
+    ops.isatty = devhost_log_isatty;
     return ops;
 }();
 
-- 
GitLab