Details
-
Bug
-
Resolution: Out of scope
-
P1: Critical
-
None
-
5.10.1
Description
When starting a PowerShell script via QProcess and not manually redirecting the stdin via setStandardInputFile(), a [Console]::ReadLine call within the PowerShell script freezes the computation of the script independently of write calls in QProcess.
Steps to reproduce the issue:
1. Run the attached test application
2. Close MessageBox of the PowerShell script ("Loop begin")
Outcome: The PowerShell script freezes in ReadLine. Subsequent write calls from the Qt code have no influence now. The PowerShell script does not continue and finish.
Tested on:
Windows7 with PowerShell >=4.0
Notes:
The Qt implementation is in qtbase\src\corelib\io\qprocess_win.cpp function static void qt_create_pipe(.)
A named pipe is created with flag FILE_FLAG_OVERLAPPED.
Later in this function, ConnectNamedPipe() is called with NULL as Overlapped argument (152) :
// Wait until connection is in place.
ConnectNamedPipe(hServer, NULL);
This is not allowed according to the Microsoft documentation - and seems to cause the problem:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365146(v=vs.85).aspx
"If hNamedPipe was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped
parameter must not be NULL. It must point to a valid OVERLAPPED structure."
The FILE_FLAG_OVERLAPPED flag was introduced in "QProcess/Win: use named pipes for redirecting standard I/O" 9efbc9f60a511e902d3f8b368296212b43222f52 https://codereview.qt-project.org/#/c/12475/ .
Attachments
Issue Links
- relates to
-
QTBUG-35357 QProcess pipe creation on Windows uses wrong modes
- Closed