How do make a call to a ruby script and pass some parameters and once the script is finished return the control back to the c# code with the result?
+2
A:
void runScript()
{
using (Process p = new Process())
{
ProcessStartInfo info = new ProcessStartInfo("ruby C:\rubyscript.rb");
info.Arguments = "args"; // set args
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.UseShellExecute = false;
p.StartInfo = info;
p.Start();
string output = p.StandardOutput.ReadToEnd();
// process output
}
}
Jake
2010-02-18 00:24:18
thanks that what i was looking for.
Jonathan
2010-02-19 00:01:20