[Mono-list] command

Fabian fseoane@wanadoo.es
Mon, 09 Aug 2004 17:10:42 +0200


--=-EH/0fm+Oa4lX9v3yIi+q
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

El lun, 09-08-2004 a las 14:57, Jonathan Stowe escribi=F3:

> 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:=20
> >=20
> >             System.Diagnostics.Process proc =3D new
> > System.Diagnostics.Process();=20
> >             proc.EnableRaisingEvents=3Dfalse;
> >             proc.StartInfo.FileName=3D "ls";=20
> >             proc.StartInfo.Arguments =3D "-lh";=20
> >             proc.Start();=20
> >             proc.WaitForExit();=20
> >=20
> > The problem is that it doesen't work unless i'm root. Otherwise I get:
> >=20
> > 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 ()
> >=20
> >=20
> > Is there a way to execute a shell command without being root ?
>=20
> 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?


I'm running Debian Sid.

Thanks for the info, i'll hack a bit to see what's wrong.


>=20
> /J\
>=20
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

--=-EH/0fm+Oa4lX9v3yIi+q
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
El lun, 09-08-2004 a las 14:57, Jonathan Stowe escribi&#243;:
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>On Mon, 2004-08-09 at 14:15, Fabian wrote:
&gt; Hi!. If i'm not wrong, if i want to execute a shell command like &quot;ls
&gt; -lh&quot; I must paste the following code: 
&gt; 
&gt;             System.Diagnostics.Process proc = new
&gt; System.Diagnostics.Process(); 
&gt;             proc.EnableRaisingEvents=false;
&gt;             proc.StartInfo.FileName= &quot;ls&quot;; 
&gt;             proc.StartInfo.Arguments = &quot;-lh&quot;; 
&gt;             proc.Start(); 
&gt;             proc.WaitForExit(); 
&gt; 
&gt; The problem is that it doesen't work unless i'm root. Otherwise I get:
&gt; 
&gt; Unhandled Exception: System.ComponentModel.Win32Exception: Cannot find
&gt; the specified file
&gt; in &lt;0x00657&gt; System.Diagnostics.Process:Start_common
&gt; (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process)
&gt; in &lt;0x0003d&gt; System.Diagnostics.Process:Start
&gt; (System.Diagnostics.ProcessStartInfo)
&gt; in &lt;0x00029&gt; System.Diagnostics.Process:Start (string)
&gt; in &lt;0x0000f&gt; prueba:Main ()
&gt; 
&gt; 
&gt; 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?</I></FONT></PRE>
</BLOCKQUOTE>
<BR>
I'm running Debian Sid.<BR>
<BR>
Thanks for the info, i'll hack a bit to see what's wrong.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>
/J\

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com</FONT>
<A HREF="http://lists.ximian.com/mailman/listinfo/mono-list"><U>http://lists.ximian.com/mailman/listinfo/mono-list</U></I></A></PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-EH/0fm+Oa4lX9v3yIi+q--