Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryStream trouble on Mono #6

Closed
JonSargent opened this issue Aug 16, 2016 · 4 comments
Closed

MemoryStream trouble on Mono #6

JonSargent opened this issue Aug 16, 2016 · 4 comments
Labels
Milestone

Comments

@JonSargent
Copy link

Terrific library.

Potentially obscure question... I was just testing input redirection similar to this example:
var cmd = Command.Run("path_to_grep", "some REGEX") < new FileInfo("some path") > lines;
but from a memory stream.

On Windows, when the executable I'm running fails, it fails beautifully -- the expected exit code is returned, and stderr gets stored in cmd.StandardError.

However, on Ubuntu using mono, I get a FileStream.Write exception instead. Any idea what might be causing this, and whether there's a workaround?

Thanks! Exception details below.

Jon

System.IO.IOException: Write fault on path /opt/myfolder/[Unknown]
at System.IO.FileStream.WriteInternal (System.Byte[] src, Int32 offset, Int32 count) [0x00000] in :0
at System.IO.FileStream.Write (System.Byte[] array, Int32 offset, Int32 count) [0x00000] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at Medallion.Shell.Streams.ProcessStreamWriter+<>c__DisplayClass2+<b__0>d__4.MoveNext () [0x00000] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at Medallion.Shell.Streams.PipeHelpers+d__a.MoveNext () [0x00000] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in :0
at Medallion.Shell.IoCommand+d__0.MoveNext () [0x00000] in :0
Void ThrowIfExceptional(Boolean)

@madelson
Copy link
Owner

Hi @JonSargent, thanks for reporting this.

I haven't tested on Mono so I haven't encountered this issue.

Can you post a complete program which reproduces the error including any setup notes for external executables/files? Also, do you know whether this is reproducible when running Mono on Windows? I ask because I don't currently have a Linux environment readily available for testing.

@madelson
Copy link
Owner

@JonSargent having researched this a bit it seems like this might be Mono's behavior for writing to Standard Input after the process exits. See http://stackoverflow.com/questions/15399234/cant-write-input-to-process-c-sharp-mono.

@JonSargent
Copy link
Author

Hi @madelson, thanks for the responses. And apologies for not getting back to you sooner. I suspected a somewhat indelible issue, and it wasn't too hard for me to avoid using stdin, so I did. :)

Your hypothesis sounds plausible, though.

@madelson madelson added the bug label Jul 1, 2017
@madelson madelson added this to the 1.4 milestone Jul 1, 2017
@madelson
Copy link
Owner

madelson commented Jul 1, 2017

@JonSargent I realize this is long past where you originally hit this, but I finally had time to install Mono and reproduce the issue. I believe it should be fixed in the 1.4 release of the package (basically using a hack to swallow these errors on Mono specifically).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants