forked from pool/python-delegator.py
- Initial spec for v0.1.1, using exclude-eof-from-result.patch OBS-URL: https://build.opensuse.org/request/show/682891 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-delegator.py?expand=0&rev=1
41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
--- delegator.py-0.1.1/delegator.py.orig 2018-09-18 02:35:34.000000000 +0700
|
|
+++ delegator.py-0.1.1/delegator.py 2019-03-08 00:53:35.605573650 +0700
|
|
@@ -7,6 +7,8 @@
|
|
import errno
|
|
|
|
from pexpect.popen_spawn import PopenSpawn
|
|
+import pexpect
|
|
+pexpect.EOF.__module__ = "pexpect.exceptions"
|
|
|
|
# Include `unicode` in STR_TYPES for Python 2.X
|
|
try:
|
|
@@ -110,7 +112,7 @@
|
|
if self.subprocess.before:
|
|
result += self.subprocess.before
|
|
|
|
- if self.subprocess.after:
|
|
+ if self.subprocess.after and self.subprocess.after is not pexpect.EOF:
|
|
result += self.subprocess.after
|
|
|
|
result += self.subprocess.read()
|
|
@@ -205,7 +207,10 @@
|
|
if self.blocking:
|
|
raise RuntimeError("expect can only be used on non-blocking commands.")
|
|
|
|
- self.subprocess.expect(pattern=pattern, timeout=timeout)
|
|
+ try:
|
|
+ self.subprocess.expect(pattern=pattern, timeout=timeout)
|
|
+ except pexpect.EOF:
|
|
+ pass
|
|
|
|
def send(self, s, end=os.linesep, signal=False):
|
|
"""Sends the given string or signal to std_in."""
|
|
@@ -263,7 +268,6 @@
|
|
c.run(block=False, cwd=cwd)
|
|
if data:
|
|
c.send(data)
|
|
- c.subprocess.sendeof()
|
|
c.block()
|
|
return c
|
|
|