alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hda-emu: Flush output before prompt
@ 2012-08-08  9:54 David Henningsson
  2012-08-08  9:54 ` [PATCH 2/2] hda-emu: Initial draft of test framework implementation David Henningsson
  0 siblings, 1 reply; 4+ messages in thread
From: David Henningsson @ 2012-08-08  9:54 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: David Henningsson

When stdout is redirected, there is a risk not all stdout is sent
before the prompt is sent on stderr. Thanks to Jeremy Kerr for
help with this issue.
---
 hda-ctlsh.c       |    1 +
 hda-log.c         |    5 +++++
 include/hda-log.h |    1 +
 3 files changed, 7 insertions(+)

diff --git a/hda-ctlsh.c b/hda-ctlsh.c
index 4c21341..d84cc71 100644
--- a/hda-ctlsh.c
+++ b/hda-ctlsh.c
@@ -851,6 +851,7 @@ int cmd_loop(FILE *fp)
 	init_completion();
 
 	for (;;) {
+		hda_log_flush();
 		line = readline("> ");
 		if (!line)
 			break;
diff --git a/hda-log.c b/hda-log.c
index 65f3044..67ee8e2 100644
--- a/hda-log.c
+++ b/hda-log.c
@@ -179,6 +179,11 @@ int hda_log_level_set(int level)
 	return saved;
 }
 
+void hda_log_flush()
+{
+	fflush(logfp);
+}
+
 FILE *hda_get_logfp(void)
 {
 	return logfp;
diff --git a/include/hda-log.h b/include/hda-log.h
index 2e2137b..8b0d392 100644
--- a/include/hda-log.h
+++ b/include/hda-log.h
@@ -18,6 +18,7 @@ int hda_log_init(const char *file, unsigned int flags);
 void hda_log(int level, const char *fmt, ...);
 void hda_log_printk(const char *fmt, ...);
 void hda_log_echo(int level, const char *fmt, ...);
+void hda_log_flush(void);
 
 extern int hda_log_trap_on_error;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-08  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-08  9:54 [PATCH 1/2] hda-emu: Flush output before prompt David Henningsson
2012-08-08  9:54 ` [PATCH 2/2] hda-emu: Initial draft of test framework implementation David Henningsson
2012-08-08  9:55   ` David Henningsson
2012-08-08 10:03     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).