[Mono-list] Can't launch processes as normal user
Gonzalo Paniagua Javier
gonzalo@ximian.com
13 Mar 2003 20:18:26 +0100
--=-FjR/7DPbj55OsK+UNEsu
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
El jue, 13 de 03 de 2003 a las 16:23, Pablo Baena escribió:
> as user, shows nothing, but running it as root shows the contents of
> the directory. It is just an example, I tried to see if it actually
> executes the command, and it doesn't as user.
>
> I tried all the versions of mono from 0.19 to 0.23 and none of them
> worked.
>
> Again: is this a bug or a new policy?
It works fine for me. Try the attached program (run it like 'mono
ptest.exe binary_program args to binary program').
-Gonzalo
--=-FjR/7DPbj55OsK+UNEsu
Content-Disposition: attachment; filename=ptest.cs
Content-Type: text/plain; name=ptest.cs; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
using System;
using System.Diagnostics;
using System.Text;
class C
{
static void Main (string [] args)
{
if (args.Length =3D=3D 0) {
Console.WriteLine ("No args");
return;
}
=09
Process process =3D new Process ();
process.StartInfo.FileName =3D args [0];
string arguments =3D String.Empty;
if (args.Length > 1) {
StringBuilder b =3D new StringBuilder ();
for (int i =3D 1; i < args.Length; i++) {
b.Append (args [i]);
b.Append (' ');
}
arguments =3D b.ToString ();
}
=09
process.StartInfo.Arguments =3D arguments;
process.StartInfo.UseShellExecute =3D false;
process.StartInfo.RedirectStandardOutput =3D true;
process.Start ();
string poutput =3D process.StandardOutput.ReadToEnd ();
process.WaitForExit ();
int result =3D process.ExitCode;
process.Close ();
Console.WriteLine ("RC: {1} The output is:\n{0}", poutput, result);
}
}
--=-FjR/7DPbj55OsK+UNEsu--