cleartool не ведет себя одинаково между командной строкой и из приложения C # - PullRequest
2 голосов
/ 20 января 2011

Я пытаюсь получить список привилегий просмотра в определенном каталоге из приложения C#.
Я использую функцию ниже, чтобы сделать этот вызов с:

ClearCommand = "ls -r -view_only" 

и

directory = @"E:\VobName\sampleDir". 

Возвращает:

cleartool: Error: Pathname is not within a VOB: "E:\VobName\Sampledir"

Если я выполняю ту же команду в командной строке Windows из E:\VobName\sampleDir, она работает нормально.
Любая идея о том, почему это несоответствие в том, как оно работает?


Вот соответствующий код:

    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;
    }

1 Ответ

0 голосов
/ 21 января 2011
E:\VobName\Sampledir

- буква диска, назначаемая пути. См. Команду Windows subst.
Вы пробовали с фактическим полным путем просмотров?

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

или

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