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)

See Also:
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

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.

Note You need to log in before you can comment on or make changes to this bug.