I am working on achieving the execution of commands on pig grunt shell using c#. I am able to start the grunt shell through c# program using the following code:
proc = new Process {StartInfo = new ProcessStartInfo
{
FileName = PIG_BIN + "\\pig.cmd",
UseShellExecute = false,
RedirectStandardError = true ,
RedirectStandardOutput = true,
RedirectStandardInput = true,
CreateNoWindow = true
}
};
I read the output and error through the following methods and events:
proc.OutputDataReceived += proc_OutputDataReceived;
proc.BeginOutputReadLine();
proc.ErrorDataReceived += proc_ErrorDataReceived;
proc.BeginErrorReadLine();
But, I am unable to read the output line from grunt shell. But, only the lines before the "grunt>" is alone read.
I pass arguments to grunt shell through the following command,
proc.StandardInput.WriteLine("dump a;");
I am not able to pass the arguments to grunt shell too. A java process is started when we start the grunt shell. If I end the java.exe in command prompt, "OutputDataReceived " event is hit and "grunt>" is obtained.
I hope that grunt is running as a java process and hence we are not able to pass and receive arguments to and from it. Is there any way to achieve it??