Bug 34596 - Redirect standard input between process is not correctly working
Summary: Redirect standard input between process is not correctly working
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-06 13:51 UTC by rubarax
Modified: 2015-10-06 18:03 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
it contains: parent.cs (parent process); child.cs (child process); child (child script) (1.43 KB, application/octet-stream)
2015-10-06 13:51 UTC, rubarax
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 34596 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description rubarax 2015-10-06 13:51:11 UTC
Created attachment 13207 [details]
it contains: parent.cs (parent process); child.cs (child process); child (child script)

Description:

1) One "parent" process launches a "child" process.
2) The stardard input of the child process is redirected.
3) The parent process writes in the child process input.
4) The child process fails to read what the parent process wrote with ReadToEnd or ReadLine and got stuck.

Versions:

* It worked with mono-4.0.4
* It failed with master/020a7c6 and master/5ab4c0d.

Code:

The code of parent and the client process is attached.

The way to execute the different scenario is:

parent.exe "child --readtoend" -----> hang
parent.exe "child --readtoend" "input line" -----> hang

parent.exe "child --readline" -----> hang
parent.exe "child --readline" "input line" -----> hang

parent.exe "child --read" -----> hang
parent.exe "child --read" "input line" -----> ok
Comment 1 rubarax 2015-10-06 18:03:55 UTC
I forgot to explain the parameters of the execution examples (although I think that the code is pretty easy).

* parent.exe (the name of the parent process assembly).

* "child --xxx" (the name of the child process executable, it invokes a 'mono child.exe' script) plus the mode that will use the child process to read from the console input.
** --readtoend -> it will do a Console.In.ReadToEnd();
** --readline -> it will do Console.ReadLine() reads.
** --read -> it will do Console.Read() reads checking if there are something to read with Console.In.Peek()

* "input line" -> the parent process will write the following parameters to the standard input of the child process. In this case, it will write just one "input line".
** if this parameter is missing the parent process will write nothing.