2017-03-15 62 views
0

对微软的Visual Studio 2015年Git的窗户后,“验证包”的过程

我有一个函数来验证包文件使用.NET4内停止工作。 Git的命令是一个进程内运行,像这样:

public VerifyBundle(String bundlePath, String repositoryPath){ 
    Directory.SetCurrentDirectory(repositoryPath); 
      Process p = new Process 
      { 
       //set process configuration 
       StartInfo = new ProcessStartInfo 
       { 
        UseShellExecute = false, 
        FileName = "cmd.exe", 
        RedirectStandardInput = true, 
        RedirectStandardOutput = true, 
        RedirectStandardError = true, 
        WorkingDirectory = path, 
        Arguments = "/C git bundle verify " + bundlePath, 
        WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden 
       } 
      }; 
      p.Start(); 

      string output = p.StandardOutput.ReadToEnd(); 
} 

每当.bundle文件无效,则p.Start之后,Git会停止,并打开一个弹出说:“混帐窗户停止工作”。 为什么在这个过程中打破GIT?我能做些什么来拦截这个错误并避免在运行时中断我的应用程序?

编辑:混帐上猛砸手动运行该命令对同样的文件输出 Segmentation Error

+0

通过命令提示符手动发出git命令是否正常工作?也就是说,当针对无效的捆绑文件运行时,它会崩溃吗?还是仅输出错误消息? –

回答

1

这似乎是与Git for Windows MinGW的版本中的错误,它不会与Cygwin's版本发生。

尽可能使用Cygwin的版本,尽管它是git的早期版本,因为它没有这个问题。