title: Using C# System.Diagnostics.Process under Wine on Linux
body: <p>I'm trying to port a GUI application which was developed under Visual Studio C# to run under Wine on Linux. I'm having problems with the Process class. The following program works as expected when compiled with mcs and run using mono:</p>
  
  <pre><code>using System.Diagnostics;
  using System;
  
  class TestProcess {
    static void Main() {
      Process process = new Process();
      process.StartInfo.UseShellExecute = false;
      process.StartInfo.FileName = "/usr/bin/find";
      process.StartInfo.RedirectStandardOutput = true;
      process.StartInfo.RedirectStandardError = true;
      process.StartInfo.Arguments = "/sys";
  
      process.ErrorDataReceived += new DataReceivedEventHandler(output);
      process.OutputDataReceived += new DataReceivedEventHandler(output);
  
      process.Start();
      process.BeginErrorReadLine();
      process.BeginOutputReadLine();
      process.WaitForExit();
    }
  
    static void output(object sender, DataReceivedEventArgs e) {
      Console.WriteLine(e.Data);
    }
  }
  </code></pre>
  
  <p>But when I run it using wine (I've installed Mono for Windows under Wine), it fails with this exception:</p>
  
  <pre><code>Unhandled Exception: System.InvalidOperationException: Standard error has not been redirected or process has not been started.
    at System.Diagnostics.Process.BeginErrorReadLine () [0x00000] in &lt;filename unknown&gt;:0 
    at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:BeginErrorReadLine ()
    at TestProcess.Main () [0x00000] in &lt;filename unknown&gt;:0 
  </code></pre>
  
  <p>What am I doing wrong?</p>