alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: tiwai@suse.de, alsa-devel@alsa-project.org
Cc: David Henningsson <david.henningsson@canonical.com>
Subject: [PATCH 1/2] hda-emu: Flush output before prompt
Date: Wed,  8 Aug 2012 11:54:29 +0200	[thread overview]
Message-ID: <1344419670-8946-1-git-send-email-david.henningsson@canonical.com> (raw)

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

             reply	other threads:[~2012-08-08  9:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08  9:54 David Henningsson [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344419670-8946-1-git-send-email-david.henningsson@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).