Skip to content

Commit ce02890

Browse files
committed
[JENKINS-16021] 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 ce02890

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public String getToolHome() {
7373
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {
7474
FilePath dir = preferredLocation(tool, node);
7575
// TODO support Unix scripts with interpreter line (see Shell.buildCommandLine)
76-
FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command);
76+
FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command, false);
7777
try {
7878
String[] cmd = getCommandCall(script);
7979
int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join();

0 commit comments

Comments
 (0)