From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/
Date: Sun, 17 Jul 2011 21:21:27 +0000 (UTC) [thread overview]
Message-ID: <dc7905fbd4aa0ec1305cf4b246794f8b7de0f328.mgorny@gentoo> (raw)
commit: dc7905fbd4aa0ec1305cf4b246794f8b7de0f328
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 17 21:21:22 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 17 21:21:22 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=dc7905fb
Fix looping BashServer when pipes are closed.
Ensure BashServer will exit when stdin is closed (read returns non-zero)
rather than letting it loop and eat CPU.
---
gentoopm/bash/bashserver.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gentoopm/bash/bashserver.py b/gentoopm/bash/bashserver.py
index 98d5ede..774c741 100644
--- a/gentoopm/bash/bashserver.py
+++ b/gentoopm/bash/bashserver.py
@@ -9,12 +9,15 @@ from gentoopm.bash import BashParser
from gentoopm.exceptions import InvalidBashCodeError
_bash_script = '''
-while true; do
+while
(
while read -r __GENTOOPM_CMD; do
eval ${__GENTOOPM_CMD}
done
+ exit 1
)
+do
+ :
done
'''
@@ -37,7 +40,7 @@ class BashServer(BashParser):
shutil.copyfileobj(envf, f)
f.flush()
- self._write('break',
+ self._write('exit 0',
'source %s && printf "OK\\0" || printf "FAIL\\0"' % repr(f.name))
resp = self._read1()
f.close()
next reply other threads:[~2011-07-17 21:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-17 21:21 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-08-05 8:50 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/bash/ Michał Górny
2013-08-04 12:52 Michał Górny
2011-07-15 16:08 Michał Górny
2011-07-15 16:08 Michał Górny
2011-07-15 16:08 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-10 21:37 Michał Górny
2011-07-10 21:37 Michał Górny
2011-07-10 21:37 Michał Górny
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=dc7905fbd4aa0ec1305cf4b246794f8b7de0f328.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.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