[Mono-dev] excute linux command under mono C#

nekresh nekresh at gmail.com
Wed May 18 04:36:42 EDT 2011


Standard non-error exit code on linux is 0
If you get something else then an error as occured.

Are you sure that both path exists ?
Do you have read/write rights ?

On Wed, May 18, 2011 at 10:22 AM, harmeet.singh at onebcg.com <
harmeet.singh at onebcg.com> wrote:

>  Hi
>
> I tried the code. My code is
>
> protected void Button1_Click(object sender, EventArgs e)
>     {
>         Label1.Text=Execute("/bin/cp"," -rp
> /usr/local/lib/xsp/test/2.0/projectname/invoices/
> /usr/local/lib/xsp/test/2.0/projectname/testupload/").ToString();
>
>     }
>     internal int Execute(string exe, string args)
>     {
>         ProcessStartInfo oInfo = new ProcessStartInfo(exe, args);
>         oInfo.UseShellExecute = false;
>         oInfo.CreateNoWindow = true;
>
>         oInfo.RedirectStandardOutput = true;
>         oInfo.RedirectStandardError = true;
>
>
>
>         Process proc = System.Diagnostics.Process.Start(oInfo);
>         proc.WaitForExit();
>         int exitCode = proc.ExitCode;
>         proc.Close();
>
>         return exitCode;
>     }
>
>
> Output returned is 1. But Files are not copied to destination folder. Any
> suggestions.
>
>   Regards,
>
> Harmeet Singh
> Software Engineer .NET
> Ext: 3023
>
>  Phone AU: +61 2 9114 6001    |    IN: +91 172 424 8888    |    UK: +44
> 2070 99 88 50    |    US: +1 866 420 9555
>  FaxAU: +61 2 9114 6002    |    IN: +91 172 424 8889    |    UK: +44 2070
> 99 49 55    |    US: +1 480 304 3080
>  [image: ONE BCG] <http://www.onebcg.com>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited.
> Please consider the environment before printing this email
>
>
>
> On 5/17/2011 4:04 PM, nekresh wrote:
>
> On Tue, May 17, 2011 at 12:03 PM, harmeets <harmeet.singh at onebcg.com> <harmeet.singh at onebcg.com> wrote:
>
>  Hi what will be exe and args here?
>
>
> With your command : /bin/cp -rp
> /usr/local/lib/xsp/test/2.0/projectname/invoices/
> /usr/local/lib/xsp/test/2.0/projectname/testupload/
>
> The exe part will be "/bin/cp"
> and the args part will be "-rp
> /usr/local/lib/xsp/test/2.0/projectname/invoices/
> /usr/local/lib/xsp/test/2.0/
> projectname/testupload/"
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110518/bc7da454/attachment-0001.html 


More information about the Mono-devel-list mailing list