【问题标题】:cleartool not behaving the same between command prompt and from within a C# applicationcleartool 在命令提示符和 C# 应用程序中的行为不同
【发布时间】:2011-01-20 20:56:53
【问题描述】:

我正在尝试从 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;
    }

【问题讨论】:

    标签: c# clearcase cleartool processstartinfo


    【解决方案1】:
    E:\VobName\Sampledir
    

    是分配给路径的驱动器号。请参阅Windows command subst。
    您是否尝试过视图的实际完整路径?

    (snapshot view)
    C:\path\to\myView\VobName\Sampledir
    

    或:

    (dynamic view)
    M:\myView\VobName\Sampledir
    

    【讨论】:

    • 原评论中的路径为完整路径。我有一个专用于静态视图的分区 (E:\)。
    • @JGoforth:不,这不是完整路径。快照视图意味着:<drive>:\aViewName\aVobName\someDirs。在驱动器号之后直接有一个VobName 意味着一个subst 已经完成(例如通过带有View shortcut 的ClearCase Explorer)
    猜你喜欢
    • 1970-01-01
    • 2011-10-31
    • 1970-01-01
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多