Hi Yves,
On 10/01/2011 08:17 PM, Yves Goergen wrote:
> I am debugging a problem with my .NET application calling a UNIX
> programme with arguments. The bash command line looks like this:
>
> /usr/bin/smem -P '/usr/sbin/exim4(\s|$)'
>
> My C# code to do exactly that is the following:
>
> string processPath = "/usr/sbin/exim4(\s|$)";
> ProcessStartInfo psi = new ProcessStartInfo(
> "smem",
> "-P '" + processPath + "'");
> psi.RedirectStandardOutput = true;
> psi.UseShellExecute = false;
> Process p = Process.Start(psi);
>
> But this is what the started programme gets as arguments:
>
> ['/usr/bin/smem', '-P', '/usr/sbin/exim4(s|$)']
I guess that Mono is using bash to execute the command line and that is doing
an additional 'resolve'.
Try to set:
psi.UseShellExecute = false; // Default is true
or double-escape the argument as in:
string processPath = "/usr/sbin/exim4(\\\\s|$)";
Cheers,
/uli
--
Ulrich Hertlein
Research and Development mailto:[email protected]
XDT Pty Ltd http://www.xdt.com.au
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list