[Mono-list] command
Jonathan Stowe
jns@gellyfish.com
Mon, 09 Aug 2004 13:57:06 +0100
On Mon, 2004-08-09 at 14:15, Fabian wrote:
> Hi!. If i'm not wrong, if i want to execute a shell command like "ls
> -lh" I must paste the following code:
>
> System.Diagnostics.Process proc = new
> System.Diagnostics.Process();
> proc.EnableRaisingEvents=false;
> proc.StartInfo.FileName= "ls";
> proc.StartInfo.Arguments = "-lh";
> proc.Start();
> proc.WaitForExit();
>
> The problem is that it doesen't work unless i'm root. Otherwise I get:
>
> Unhandled Exception: System.ComponentModel.Win32Exception: Cannot find
> the specified file
> in <0x00657> System.Diagnostics.Process:Start_common
> (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process)
> in <0x0003d> System.Diagnostics.Process:Start
> (System.Diagnostics.ProcessStartInfo)
> in <0x00029> System.Diagnostics.Process:Start (string)
> in <0x0000f> prueba:Main ()
>
>
> Is there a way to execute a shell command without being root ?
Your exact code works fine for me - it is almost something certainly
strange about your system rather than with mono. What OS are you trying
to run this on?
/J\