projects
/
sitarba.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8bc0914
)
tarp's output: clean up code
author
Stefan Huber <shuber2@gmx.at>
Tue, 15 May 2012 10:06:22 +0000
(12:06 +0200)
committer
Stefan Huber <shuber2@gmx.at>
Tue, 15 May 2012 10:06:22 +0000
(12:06 +0200)
shbackup
patch
|
blob
|
history
diff --git
a/shbackup
b/shbackup
index 977fb5cd35403ccdf4fc41cc172369fa598d0b2d..a45305e59ae8e9f1f88f28126065bfd457618c8c 100755
(executable)
--- a/
shbackup
+++ b/
shbackup
@@
-286,28
+286,14
@@
class BackupManager:
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
- def readlineNonBlocking(stream):
- """Read a line nonblocking. Returns b'' if nothing read."""
- try:
- return stream.readline()
- except:
- return b''
- pass
-
-
# Read stdout and stderr of tarp
errmsg = b""
while tarp.poll() == None:
rd,wr,ex = select.select([tarp.stdout, tarp.stderr], [], [], 0.05)
# Read stdout and stderr of tarp
errmsg = b""
while tarp.poll() == None:
rd,wr,ex = select.select([tarp.stdout, tarp.stderr], [], [], 0.05)
-
if tarp.stdout in rd:
if tarp.stdout in rd:
- l = readlineNonBlocking(tarp.stdout)
- if l != b"":
- logging.debug(l[:-1].decode())
-
+ logging.debug( tarp.stdout.readline()[:-1].decode() )
if tarp.stderr in rd:
if tarp.stderr in rd:
- errmsg += readlineNonBlocking(tarp.stderr)
-
+ errmsg += tarp.stderr.read()
# Get the remainging output of tarp
for l in tarp.stdout.readlines():
# Get the remainging output of tarp
for l in tarp.stdout.readlines():