Search in sources :

Example 1 with ProcessTimeoutCallback

use of jetbrains.buildServer.buildTriggers.vcs.git.command.impl.ProcessTimeoutCallback in project teamcity-git by JetBrains.

the class AgentGitFacadeImpl method resolvePath.

@NotNull
public String resolvePath(@NotNull File f) throws VcsException {
    try {
        final GitExec gitExec = getCtx().getGitExec();
        if (gitExec.isCygwin()) {
            String cygwinBin = gitExec.getCygwinBinPath();
            GeneralCommandLine cmd = new GeneralCommandLine();
            cmd.setWorkDirectory(cygwinBin);
            cmd.setExePath(new File(cygwinBin, "cygpath.exe").getCanonicalPath());
            cmd.addParameter(f.getCanonicalPath());
            ExecResult res = SimpleCommandLineProcessRunner.runCommandSecure(cmd, cmd.getCommandLineString(), null, new ProcessTimeoutCallback(30));
            Throwable error = res.getException();
            if (error != null)
                throw error;
            return res.getStdout().trim();
        } else {
            return f.getCanonicalPath();
        }
    } catch (Throwable e) {
        throw new VcsException("Error while resolving path " + f.getAbsolutePath() + ": " + e.getMessage(), e);
    }
}
Also used : ProcessTimeoutCallback(jetbrains.buildServer.buildTriggers.vcs.git.command.impl.ProcessTimeoutCallback) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) VcsException(jetbrains.buildServer.vcs.VcsException) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec) File(java.io.File) ExecResult(jetbrains.buildServer.ExecResult) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 File (java.io.File)1 ExecResult (jetbrains.buildServer.ExecResult)1 GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)1 ProcessTimeoutCallback (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.ProcessTimeoutCallback)1 VcsException (jetbrains.buildServer.vcs.VcsException)1 NotNull (org.jetbrains.annotations.NotNull)1