Giter Site home page Giter Site logo

winpty returns the wrong pid about winpty HOT 2 CLOSED

javruben avatar javruben commented on August 21, 2024
winpty returns the wrong pid

from winpty.

Comments (2)

rprichard avatar rprichard commented on August 21, 2024

Here's the quoted line 155 of src/win/pty.cc:

marshal->Set(String::New("pid"), Number::New((int)pc->controlPipe));

It looks like it's setting the pty.js's "pid" value to the Win32 named pipe HANDLE value, which is not a process ID. It looks like pty.js wants/needs to assign a "pid" to the terminal before the child process has actually started, so instead of using the actual child process PID, it uses this magic value instead.

In my copy of winpty, there's a winpty_get_process_id function that returns the PID of the child process. However, in src/win/pty.cc, you wouldn't be able to call winpty_get_process_id in PtyOpen -- you'd have to call it in PtyStartProcess, after calling winpty_start_process.

(Also: I'm not sure it matters, but casting a HANDLE to an int isn't going to be reliable on 64-bit Windows.)

from winpty.

rprichard avatar rprichard commented on August 21, 2024

It's not clear what happened with this issue. I can reopen if there's still something wrong.

FWIW, my understanding is that pty.js's Windows support isn't currently working, and it also uses a forked version of winpty. I'm planning on changing the winpty API soon-ish, which should make integrating node.js and winpty much easier.

from winpty.

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.