Skip to content

Commit d837343

Browse files
committed
[JENKINS-16005] Use system temp directory for CommandInstaller scripts
AbstractCommandInstaller.performInstallation() was calling createTextTempFile() with the default inThisDirectory=true, causing it to try creating temp script files in the tool's installation directory (e.g., /usr). This fails when Jenkins doesn't have write access to that directory. Changed to use createTextTempFile(..., false) to create temp files in the system temp directory (java.io.tmpdir) instead.
1 parent 587f636 commit d837343

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/java/hudson/tools/AbstractCommandInstaller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ public String getToolHome() {
7272
@Override
7373
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {
7474
FilePath dir = preferredLocation(tool, node);
75+
dir.mkdirs();
7576
// TODO support Unix scripts with interpreter line (see Shell.buildCommandLine)
76-
FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command);
77+
FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command, false);
7778
try {
7879
String[] cmd = getCommandCall(script);
7980
int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join();

0 commit comments

Comments
 (0)