public override void Run() { try { var isr = new Java.IO.InputStreamReader(inputStream); BufferedReader br = new BufferedReader(isr); string line = null; while ((line = br.ReadLine()) != null) { if (sc != null) { sc.ShellOut(line); } } } catch (IOException ioe) { // _messageAction.Invoke(ioe.ToString()); // _messageAction.Invoke(ioe.StackTrace); } }
private int ExecProcess(IList<string> cmds, FFMpegCallbacks sc) { //ensure that the arguments are in the correct Locale format // TODO: Useless since SOX is called internally. Remove. for ( int i = 0; i < cmds.Count; i++) { cmds[i] = string.Format(System.Globalization.CultureInfo.GetCultureInfo("en-US"), "%s", cmds[i]); } ProcessBuilder pb = new ProcessBuilder(cmds); pb.Directory(fileBinDir); var cmdlog = new Java.Lang.StringBuilder(); foreach (string cmd in cmds) { cmdlog.Append(cmd); cmdlog.Append(' '); } sc.ShellOut(cmdlog.ToString()); pb.RedirectErrorStream(true); var process = pb.Start(); StreamGobbler errorGobbler = new StreamGobbler(this, process.ErrorStream, "ERROR", sc); StreamGobbler outputGobbler = new StreamGobbler(this, process.InputStream, "OUTPUT", sc); errorGobbler.Run(); outputGobbler.Run(); int exitVal = process.WaitFor(); while (outputGobbler.IsAlive || errorGobbler.IsAlive); sc.ProcessComplete(exitVal); return exitVal; }