I am attempting to get the list of view privates in a particular directory from within a C#
application.
I am using the function below to make that call with:
ClearCommand = "ls -r -view_only"
and
directory = @"E:\VobName\sampleDir".
It returns:
cleartool: Error: Pathname is not within a VOB: "E:\VobName\Sampledir"
If I do the same command in the windows command prompt from within E:\VobName\sampleDir
, it works fine.
Any idea as to why there would be this inconsistency in the way it runs?
Here is the relevant code:
private String RunCommand(String clearCommand, String directory)
{
String retVal = String.Empty;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "cleartool";
startInfo.Arguments = clearCommand;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.WorkingDirectory = directory;
try
{
// Start the process with the info we specified.
// Call WaitForExit and then the using statement will close.
using (Process process = Process.Start(startInfo))
{
//exeProcess.WaitForExit();
// Read in all the text from the process with the StreamReader.
using (StreamReader reader = process.StandardOutput)
{
retVal = reader.ReadToEnd();
}
if (String.IsNullOrEmpty(retVal))
{
// Read in all the text from the process with the StreamReader.
using (StreamReader reader = process.StandardError)
{
retVal = reader.ReadToEnd();
}
}
}
}
catch
{
Debug.Assert(false, "Error sending command");
}
return retVal;
}