From 241fd0b5a8a95e814395f79b5ea7715c1862f045 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Harboe?= <oyvind.harboe@zylin.com>
Date: Sat, 18 Sep 2010 01:37:42 +0200
Subject: [PATCH] logging: turn of stdout/stderr buffering
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

with this buffering disabled fancier logging scripts will
be able to process each line as it is output.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
---
 src/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main.c b/src/main.c
index a71977daf..9c7191d6e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,5 +35,9 @@
 
 int main(int argc, char *argv[])
 {
+	/* disable buffering otherwise piping to logs causes problems work */
+	setvbuf(stdout, NULL, _IONBF, 0);
+	setvbuf(stderr, NULL, _IONBF, 0);
+
 	return openocd_main(argc, argv);
 }
-- 
GitLab