cleartool 在命令提示符和 C# 应用程序中的行为不同
我正在尝试从 C#
应用程序中获取特定目录中的视图私有列表。
我正在使用下面的函数来进行该调用:
ClearCommand = "ls -r -view_only"
并且
directory = @"E:\VobName\sampleDir".
它返回:
cleartool: Error: Pathname is not within a VOB: "E:\VobName\Sampledir"
如果我在 E:\VobName\sampleDir
中的 Windows 命令提示符中执行相同的命令,则它可以正常工作。
知道为什么它的运行方式会出现这种不一致吗?
这是相关代码:
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;
}
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是分配给路径的驱动器号。请参阅 Windows 命令 <强>
subst
。您是否尝试过视图的实际完整路径?
或者:
is a drive letter assign to a path. See the Windows command
subst
.Did you try with the actual full path of the views?
or: