Closed
Description
In the case of providing an invalid option to a cmd-line tool, I would except to receive the cmd's exit code of 1 (in this case, running ffmpeg via Xamarin.Android
), instead an IOException
thrown.
FYI: When ffmpeg is provided the correct option(s) and/or a media file that it can transcode, MedallionShell works great on Xamarin.Android (thanks 😀 )
Example code:
var cmd = Command.Run(ffmpegPath, (new string[]
{
"-hide_banner",
"-some_invalid_option",
}), ((options) =>
{
options.WorkingDirectory(workingDir);
}));
var tasks = new List<Task>
{
cmd.Task,
cmd.StandardOutput.PipeToAsync(stdOutCollection),
cmd.StandardError.PipeToAsync(stdErrCollection)
};
Task.WaitAll(tasks.ToArray());
exitCode = cmd.Result.ExitCode;
Note: stdOutCollection/stdErrCollection are ObservableCollections
Exception/Stacktrace:
[MonoDroid] System.IO.IOException: Write fault on path /[Unknown]
[MonoDroid] at System.IO.FileStream.WriteInternal (System.Byte[] src, System.Int32 offset, System.Int32 count) [0x00077] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.IO.FileStream.Write (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x00090] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00042] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.IO.StreamWriter.set_AutoFlush (System.Boolean value) [0x00010] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x00353] in <5a97d41d36694fb19855c17429527b10>:0
[MonoDroid] at System.Diagnostics.Process.Start () [0x0003a] in <5a97d41d36694fb19855c17429527b10>:0
[MonoDroid] at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
[MonoDroid] at Medallion.Shell.ProcessCommand..ctor (System.Diagnostics.ProcessStartInfo startInfo, System.Boolean throwOnError, System.Boolean disposeOnExit, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken, System.Text.Encoding standardInputEncoding) [0x0004a] in <dcb0641c39fd4991a9750bcbbb6f72ce>:0
[MonoDroid] at Medallion.Shell.Shell.Run (System.String executable, System.Collections.Generic.IEnumerable`1[T] arguments, System.Action`1[T] options) [0x000f6] in <dcb0641c39fd4991a9750bcbbb6f72ce>:0
[MonoDroid] at Medallion.Shell.Command.Run (System.String executable, System.Collections.Generic.IEnumerable`1[T] arguments, System.Action`1[T] options) [0x00005] in <dcb0641c39fd4991a9750bcbbb6f72ce>:0
[MonoDroid] at GifVideo.MainActivity+<>c__DisplayClass2_0.<OnCreate>b__4 () [0x00088] in /Volumes/Code/code/Projects/GifVideo/GifVideo/MainActivity.cs:72
[MonoDroid] at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Threading.Tasks.Task.Execute () [0x00010] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at GifVideo.MainActivity+<>c__DisplayClass2_0+<<OnCreate>b__2>d.MoveNext () [0x00048] in /Volumes/Code/code/Projects/GifVideo/GifVideo/MainActivity.cs:47
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <fa70666c4440451cb5ca34569f933bb4>:0
[MonoDroid] at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <f7bb669be1a3453caf7f53a12b803ea2>:0
[MonoDroid] at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <f7bb669be1a3453caf7f53a12b803ea2>:0
[MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <f7bb669be1a3453caf7f53a12b803ea2>:0
[MonoDroid] at (wrapper dynamic-method) System.Object.c7921d6c-67df-4e70-810d-9325c40be88e(intptr,intptr)
Metadata
Metadata
Assignees
Labels
No labels