Comments (7)
(On POSIX, I'm just using a selector, which seems to be ok.)
from slug.
The cross-platform solution is to have a background singleton that reads from all the pipes we care about and dispatch to the object that cares about it at the moment. (ie, the home-spun event loop option) Which will be fine until someone wants to coordinate those changes with something that can't be controlled the same way (eg, an external process).
from slug.
Note: WaitForMultipleObjectsEx()
EDIT: Doesn't work on pipes.
from slug.
PeekNamedPipe()
does work on anonymous pipes, though.
EDIT: .fileno()
returns some kind of emulated file descriptor with Unix-like semantics, not the actual windows handle. Oddly, Win32 calls want the handle, not the file descriptor.
from slug.
The winvalve branch tries to use CancelSynchronousIo()
. This doesn't work because CPython's .read()
loops on the C read()
call unless there's a Python exception and an interrupted flag is set. (Or the C read()
not breaking, I didn't dig deep enough to tell the difference.)
The winvalve-peek branch tries to use PeekNamedPipe()
, but fails due to the file descriptor emulation layer and the true win32 handles being hidden from us. (Basically, _pipe()
vs CreatePipe()
)
from slug.
Oh, and just as a reminder: These might need to be used with other things (standard IO, files, etc)
from slug.
So I think ReadFile()
/CancelSyncronousIO()
is the way to go on this, because it should support whatever kind of file-like that gets passed in. To avoid the file descriptor/handle issue, use _get_osfhandle()
(Py). (Note that this handle is managed by the ms c runtime and should NOT be closed by slug. Slug should maintain a reference to the Python file object associated with the file descriptor and delete its copy of the handle before letting the file object fall out of scope.)
from slug.
Related Issues (20)
- Windows Support HOT 1
- Implement Virtual Processes
- context issue HOT 9
- Test on Cygwin
- Test on WSL
- Add stop method to plumbing HOT 1
- State Change Notifications
- pipeline not work HOT 14
- Cache pgid HOT 3
- Text-mode Pipes
- Virtual file connectors
- PyPy support
- Process Return Code on premature death? HOT 1
- [RFC] Dependency Injection? HOT 2
- Terminal Duplication
- PG doesn't initialize with staggered start HOT 2
- ProcessGroup.join() won't block on descendant processes
- Joining descendants of virtual processes to process groups
- Add topics to the repo
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 slug.