Command.StandardOutput.ReadToEnd() hangs every time
See original GitHub issue Process.GetProcessesByName("adb").ToList().ForEach(x => x.Kill());
var arguments = new List<string> { "connect", "127.0.0.1:21503" };
var command = Command.Run("adb.exe", arguments,
options => options.Timeout(TimeSpan.FromMinitues(1)));
var output = command.StandardOutput.ReadToEnd();
var error = command.StandardError.ReadToEnd();
adb.exe is is Android Debug Bridge
- the code snippet hangs every time with adb.exe version 1.0.31
- options.Timeout does not work, the underline process still running after 1 minute
- the code snippet works well with adb.exe version 1.0.39
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (14 by maintainers)
Top Results From Across the Web
StandardOutput.ReadToEnd() hangs [duplicate]
The problem is that you are using the synchronous ReadToEnd methods on both the StandardOutput and the StandardError streams. This can lead to...
Read more >[Solved]-StandardOutput.ReadToEnd() hangs-C#
This code snippet worked for me. The problem is that you are using the synchronous ReadToEnd methods on both the StandardOutput and the...
Read more >[Solved] StandardOutput.ReadLine Freezes
Hey there, Deadlocks are a common issue when working with RedirectStandardInput & Output. The way to avoid this is to close the RedirectIO....
Read more >Process.StandardOutput Property (System.Diagnostics)
A deadlock condition results if the parent process calls p.StandardOutput.ReadToEnd followed by p.StandardError.ReadToEnd and the child process writes enough ...
Read more >Winscp process hangs in vb.net code - Works in one ...
ReadToEnd() command. We are using this as a process to call winscp.com inside a vb.net function with saved session. saved sessions are stored...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I should’ve mentioned that it had nothing to do with the code above. Was just commenting about a separate problem that I had. Can’t get to the machine now, but I was working on a local installment trying to call out to a GET API of a vendor. I will post the code if you’re interested later. Thanks!
@compucorss I’m not sure I follow your scenario. Was the HttpRequest without the proxy setting happening in the external process? What was the connection to StandardOut? In general, ReadToEnd() cannot return until the external process either closes StandardOut or, more likely, exits. Therefore anything that would cause the external process to hang (e. g. an infinite loop, deadlock, etc) will cause ReadToEnd() to hang.