Giter Site home page Giter Site logo

Comments (5)

jquast avatar jquast commented on June 17, 2024

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.

takluyver avatar takluyver commented on June 17, 2024

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.

jquast avatar jquast commented on June 17, 2024

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.

takluyver avatar takluyver commented on June 17, 2024

I made a start on this in pexpect/ptyprocess#6.

from pexpect.

jquast avatar jquast commented on June 17, 2024

Closing, keyword argument preexec_fn of spawn() satisfies this issue.

from pexpect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.