Re: [Mono-list] Executing shell scripts from XSP2
Hi Robert, Thanks for that, actually the problem was that I needed #!/bin/sh at the top of the script. I'll move the proc.WaitForExit(). to the end. Regards, Danny > To: Mono-list@lists.ximian.com> From: [EMAIL PROTECTED]> Date: Sat, 8 Dec > 2007 21:58:05 +0100> Subject: Re: [Mono-list] Executing shell scripts from > XSP2> > Hey,> > Danny Waite wrote:> > Hi guys,> > > > I'm having a hard time > trying to call a shell script from XSP2, it seems to work on somethings and > not others. What is the best way to do this? I've included my code below...> > > > > System.Diagnostics.Process proc = new System.Diagnostics.Process();> > > proc.StartInfo.FileName = "/sbin/commit_config";> > proc.StartInfo.Arguments > = profile;> > proc.StartInfo.UseShellExecute = false;> > > proc.StartInfo.RedirectStandardOutput = true;> > proc.Start();> > > > > proc.WaitForExit();> > if (verbose)> > Console.WriteLine("result: " + > proc.StandardOutput.ReadToEnd());> > You must call > proc.StandardOutput.ReadToEnd() before proc.WaitForExit().> > Robert> > > ___> Mono-list maillist - > Mono-list@lists.ximian.com> http://lists.ximian.com/mailman/listinfo/mono-list___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Executing shell scripts from XSP2
Hey, Danny Waite wrote: > Hi guys, > > I'm having a hard time trying to call a shell script from XSP2, it seems to > work on somethings and not others. What is the best way to do this? I've > included my code below... > > System.Diagnostics.Process proc = new System.Diagnostics.Process(); > proc.StartInfo.FileName = "/sbin/commit_config"; > proc.StartInfo.Arguments = profile; > proc.StartInfo.UseShellExecute = false; > proc.StartInfo.RedirectStandardOutput = true; > proc.Start(); > > proc.WaitForExit(); > if (verbose) > Console.WriteLine("result: " + proc.StandardOutput.ReadToEnd()); You must call proc.StandardOutput.ReadToEnd() before proc.WaitForExit(). Robert ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Executing shell scripts from XSP2
Hi guys, I'm having a hard time trying to call a shell script from XSP2, it seems to work on somethings and not others. What is the best way to do this? I've included my code below... System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "/sbin/commit_config"; proc.StartInfo.Arguments = profile; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); proc.WaitForExit(); if (verbose) Console.WriteLine("result: " + proc.StandardOutput.ReadToEnd()); Could this be a permissions problem? When I run the shell script from within linux it works perfectly, but when run with within XSP2 the StandardOutput gives nothing. Help! Much appreciated, Danny___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list