Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43283

Unable to run batch script with root working directory

XMLWordPrintable

      If you try to run a batch script while in a root directory (e.g. c:\), it will fail. It looks like BatchController tries to make a temporary directory that's a sibling of the working directory, but c:\ has no parent directory. I did this in a pipeline script, I don't know if it's possible in a freestyle job (possibly if the workspace were set to c:\).

      Jenkinsfile
      node 'windows', {
      	dir 'c:\\', {
      		bat 'echo test'
      	}
      }
      
      Stacktrace
      java.lang.NullPointerException
      	at hudson.FilePath.sibling(FilePath.java:1257)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.tempDir(FileMonitoringTask.java:208)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.<init>(FileMonitoringTask.java:113)
      	at org.jenkinsci.plugins.durabletask.WindowsBatchScript$BatchController.<init>(WindowsBatchScript.java:94)
      	at org.jenkinsci.plugins.durabletask.WindowsBatchScript$BatchController.<init>(WindowsBatchScript.java:92)
      	at org.jenkinsci.plugins.durabletask.WindowsBatchScript.doLaunch(WindowsBatchScript.java:60)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launchWithCookie(FileMonitoringTask.java:68)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:63)
      	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:166)
      

            Unassigned Unassigned
            mrozekma Michael Mrozek
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: