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
using System;
using System.Diagnostics;
using System.Text;
class C
{
static void Main (string [] args)
{
if (args.Length == 0) {
Console.WriteLine ("No args");
return;
}
Process process = new Process ();
process.StartInfo.FileName = args [0];
string arguments = String.Empty;
if (args.Length > 1) {
StringBuilder b = new StringBuilder ();
for (int i = 1; i < args.Length; i++) {
b.Append (args [i]);
b.Append (' ');
}
arguments = b.ToString ();
}
process.StartInfo.Arguments = arguments;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start ();
string poutput = process.StandardOutput.ReadToEnd ();
process.WaitForExit ();
int result = process.ExitCode;
process.Close ();
Console.WriteLine ("RC: {1} The output is:\n{0}", poutput, result);
}
}