From: Ryan Harper <ryanh@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Ryan Harper <ryanh@us.ibm.com>
Subject: [Qemu-devel] [PATCH 1/4] update get_file_size to not throw error on non-existant files
Date: Fri, 13 Jan 2012 16:05:18 -0600 [thread overview]
Message-ID: <1326492321-13540-2-git-send-email-ryanh@us.ibm.com> (raw)
In-Reply-To: <1326492321-13540-1-git-send-email-ryanh@us.ibm.com>
In some cases, when qemu is just starting up the logfile hasn't yet
been created and will throw an error message into the output:
ls: cannot access .tmp-3070/logfile-3070.log: No such file or directory
if we check to see if the file is readable first then we know the file
is present and we can extract the size.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
qemu-test | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/qemu-test b/qemu-test
index c6ea595..cd102a7 100755
--- a/qemu-test
+++ b/qemu-test
@@ -54,9 +54,10 @@ checkpid() {
}
get_file_size() {
- ls -al $1 | cut -f5 -d' ' 2>/dev/null
- if test $? != 0; then
- echo 0
+ if test -r "${1}" ; then
+ ls -al $1 | cut -f5 -d' '
+ else
+ echo 0
fi
}
--
1.7.6
next prev parent reply other threads:[~2012-01-13 22:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 22:05 [Qemu-devel] [PATCH] qemu-test: qemu-test script cleanups Ryan Harper
2012-01-13 22:05 ` Ryan Harper [this message]
2012-01-13 22:05 ` [Qemu-devel] [PATCH 2/4] Add cleanup function Ryan Harper
2012-01-13 23:17 ` Eric Blake
2012-01-16 17:16 ` Ryan Harper
2012-01-17 22:03 ` Eric Blake
2012-01-20 15:33 ` Ryan Harper
2012-01-13 22:05 ` [Qemu-devel] [PATCH 3/4] Remove tabs and replace with four spaces Ryan Harper
2012-01-13 23:10 ` Anthony Liguori
2012-01-13 22:05 ` [Qemu-devel] [PATCH 4/4] Apply consistent indentation Ryan Harper
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=1326492321-13540-2-git-send-email-ryanh@us.ibm.com \
--to=ryanh@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/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).