in runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/RunAsPropertiesExtension.java [186:217]
private void onLinuxBased(final @NotNull Map<String, String> parameters, final ToolProvider toolProvider, final String script) {
try {
myCommandLineExecutor.runProcess(OurChmodHelpCmdLineSetup, 600);
} catch (ExecutionException e) {
LOG.warn(CHMOD_TOOL_NAME + " is not supported");
return;
}
try {
myCommandLineExecutor.runProcess(OurSuCmdLineSetup, 600);
} catch (ExecutionException e) {
LOG.warn(SU_TOOL_NAME + " is not supported");
return;
}
final File pathToRunAsScript = new File(toolProvider.getPath(RUN_AS_TOOL_NAME), script);
final CommandLineSetup scriptCmd =
new CommandLineSetup(pathToRunAsScript.getAbsolutePath(), Collections.<CommandLineArgument>emptyList(), Collections.<CommandLineResource>emptyList());
try {
final ExecResult res = myCommandLineExecutor.runProcess(scriptCmd, 600);
if (res.getExitCode() != 0) {
LOG.warn("RunAs is not supported");
return;
}
} catch (ExecutionException e) {
LOG.warn(CHMOD_TOOL_NAME + " is not supported");
return;
}
myIsRunAsEnabled = true;
parameters.put(Constants.RUN_AS_ENABLED, Boolean.toString(true));
}