Giter VIP home page Giter VIP logo

Comments (6)

xilun avatar xilun commented on July 20, 2024

work in progress: I can now call CreateProcess with explicit handle inheritance, and redirection from/to /dev/null is now propagated to Win32 and translated to redirection from/to NUL as a special case. Other redirections will go through a socket.

from cbwin.

xilun avatar xilun commented on July 20, 2024

With 5dc7a4b: somehow works for the general case (i.e. not only /dev/null) redirections for stdin and stdout, but not perfectly yet. Some debugging to do...

from cbwin.

xilun avatar xilun commented on July 20, 2024

I'm not sure the bug is in my code, I will do some additional tests but I already asked on the WSL GitHub bugtracker

from cbwin.

xilun avatar xilun commented on July 20, 2024

I've found a workaround and will commit it shortly.

from cbwin.

xilun avatar xilun commented on July 20, 2024

It seems that if the process that created a Winsocket inherited by others closes all its local handles before the launched processes close all their inherited handles (or implicitly release them when they terminate), it will not eventually linger gracefully when the last handle disappears (system wide). I still have some tests to do but for now this theory seems to match the observed behavior. If that theory is true, commit 291772b should make redirections work reliably for all Win32 workloads that do not create background processes inheriting the standard handles (for what is implemented now; stderr is not implemented yet). So don't use wstart with redirections and expect them to be reliable (maybe we should make it refuse to redirect?)

I must think more precisely about what should happen in this case, because the WSL caller is not supposed to continue to execute after the invoked Win32 process has terminated and flushed its own output, but OTOH if everybody lived in the WSL world (without any outbash&caller machinery) and we redirected to a regular file the behavior would be that the file continues to be filled by the background process... But that seems to be somehow tricky to implement if we have a redirection machinery: we would need to detect the Win32 situation in the first place -- I don't even know how... -- then fork and detach the WSL process so that it can continue the redirection in the background -- but then I'm not even sure the WSL subsys will let it run forever, IIRC it might be killed when the console is closed or something like that...

from cbwin.

xilun avatar xilun commented on July 20, 2024

Will reopen another bug for advanced background issues.

from cbwin.

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.