Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hang on chain if pipe nothing to awk #73

Open
RPing opened this issue Jun 27, 2019 · 0 comments
Open

hang on chain if pipe nothing to awk #73

RPing opened this issue Jun 27, 2019 · 0 comments

Comments

@RPing
Copy link

RPing commented Jun 27, 2019

delegator.chain("printf '' | awk '{print $1}'") would hang, while
delegator.run("printf '' | awk '{print $1}'") wouldn't.
It seems that the command would block in pexpect

^C---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-3-fc2320a6bab7> in <module>
----> 1 delegator.chain("printf '' | awk '{print $1}'")

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/delegator.py in chain(command, timeout, cwd, env)
    308             c.subprocess.sendeof()
    309
--> 310         data = c.out
    311
    312     return c

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/delegator.py in out(self)
    126             self.__out = self.std_out.read()
    127         else:
--> 128             self.__out = self._pexpect_out
    129
    130         return self.__out

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/delegator.py in _pexpect_out(self)
    114             result += self.subprocess.after
    115
--> 116         result += self.subprocess.read()
    117         return result
    118

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pexpect/spawnbase.py in read(self, size)
    439         if size < 0:
    440             # delimiter default is EOF
--> 441             self.expect(self.delimiter)
    442             return self.before
    443

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pexpect/spawnbase.py in expect(self, pattern, timeout, searchwindowsize, async_, **kw)
    339         compiled_pattern_list = self.compile_pattern_list(pattern)
    340         return self.expect_list(compiled_pattern_list,
--> 341                 timeout, searchwindowsize, async_)
    342
    343     def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1,

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pexpect/spawnbase.py in expect_list(self, pattern_list, timeout, searchwindowsize, async_, **kw)
    367             return expect_async(exp, timeout)
    368         else:
--> 369             return exp.expect_loop(timeout)
    370
    371     def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1,

~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pexpect/expect.py in expect_loop(self, timeout)
    111                 incoming = spawn.read_nonblocking(spawn.maxread, timeout)
    112                 if self.spawn.delayafterread is not None:
--> 113                     time.sleep(self.spawn.delayafterread)
    114                 if timeout is not None:
    115                     timeout = end_time - time.time()

KeyboardInterrupt:

My delegator version is 0.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant