Comments (5)
Agreed for this. More documentation than code: we need to be clear to be very careful not to raise any exceptions, as they cannot be caught or handled.
from pexpect.
I added this already to ptyprocess:
https://github.com/pexpect/ptyprocess/blob/master/ptyprocess/ptyprocess.py#L170
It takes an iterable of functions to be called with no arguments, and currently does no error handling. I'd appreciate a review of this design before moving forwards with it. I found since writing that that subprocess.Popen()
has a preexec_fn
parameter which takes a single callable, and calls it from C code (on POSIX only). There, errors are handled with the same pipe approach used for exec failure. We also have that ability (pexpect/ptyprocess#1), and I think we should use it for this.
Do you see any reasons to prefer either an iterable of functions, as I currently have, or a single function, like subprocess uses? I'm leaning slightly towards a single function for consistency with the stdlib; that function can always call other functions if the user really needs that.
from pexpect.
I'd go with the single function and consistency of naming the argument preexec_fn
as well.
There's no reason an implementer can't have their target chain multiple functions, good find on the preexec_fn.
from pexpect.
I made a start on this in pexpect/ptyprocess#6.
from pexpect.
Closing, keyword argument preexec_fn
of spawn()
satisfies this issue.
from pexpect.
Related Issues (20)
- Issue with Select module HOT 3
- Support for new release HOT 3
- Two tests hang on `cat` HOT 3
- test_large_stdout_stream timeout HOT 1
- REPLWrapTestCase.test_existing_spawn fail on illumos HOT 1
- sdist is missing requirements-testing.txt
- AttributeError: module 'asyncio' has no attribute 'coroutine' HOT 1
- Incorrect DEVELOPERS.rst
- False positive expect_exact HOT 1
- Test REPLWrapTestCase.test_pager_as_cat fails.
- An asterisk appearing out of nowhere with Clojure
- Time for a release: any reason to delay? HOT 5
- 4.9.0: git tag does not match PyPI version HOT 2
- Handling SIGTSTP possible?
- Docs not updated for 4.9?
- 4.9: pytest fails in 3 units HOT 1
- "expect()" and "await expect()" have different results on completed processes
- Pexpect does not implement enough asynchronous methods to prevent the use of time.sleep().
- add contribution documentation
- Pxssh sometime does not capture the full output of previous `sendline`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pexpect.