HaxeFoundation / HaxeFoundation/hxcpp

Reading from stdout of a process can hang on windows

Aperta
#975 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
330
Fork
227
Merge medio
2g 16h
PR unite (30g)
18

Descrizione

Noticed that sometimes reading from the stdout of a process never returns on windows. Digging into things it seems like when the child process closes the stdout pipe isn't closed as it inherits from the parent process, so `ReadFile` will block forever as the child process has closed and there will never be more data in stdout.

I managed to work around this by setting `HANDLE_FLAG_INHERIT` to 0 using `SetHandleInformation` on the stdout pipe (https://stackoverflow.com/questions/54416116/readfile-does-not-return-while-reading-stdout-from-a-child-process-after-it-ends), but if I also apply that to the stderr pipe then reading from stdout will start to block again so I'm not sure what a proper fix would be.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia individuando la configurazione delle pipe stdout e stderr del processo Windows e la gestione di ReadFile nel runtime C++. Riproduci il blocco con un processo figlio che chiude il proprio output, quindi verifica che entrambi gli stream possano essere letti fino alla fine senza bloccarsi dopo l’uscita del processo figlio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
operating-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.