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

Invocation of 'sh' on Windows should provide a more helpful error

    Details

    • Similar Issues:

      Description

      Right now if your pipeline script inadvertently tries to invoke the sh step, something approximating this error will fail your build:

      java.io.IOException: Cannot run program "nohup" (in directory "C:\Program Files (x86)\Jenkins\workspace\fathertime"): CreateProcess error=2, The system cannot find the file specified
      	at java.lang.ProcessBuilder.start(Unknown Source)
      	at hudson.Proc$LocalProc.<init>(Proc.java:244)
      	at hudson.Proc$LocalProc.<init>(Proc.java:216)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      	at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:130)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:59)
      	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:98)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:113)
      	at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1277)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1171)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
      	at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:46)
      	at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1277)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1171)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	at WorkflowScript.run(WorkflowScript:11)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:55)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
      	at sun.reflect.GeneratedMethodAccessor174.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:277)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:77)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:186)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:184)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
      	at java.lang.ProcessImpl.create(Native Method)
      	at java.lang.ProcessImpl.<init>(Unknown Source)
      	at java.lang.ProcessImpl.start(Unknown Source)
      	at java.lang.ProcessBuilder.start(Unknown Source)
      	at hudson.Proc$LocalProc.<init>(Proc.java:244)
      	at hudson.Proc$LocalProc.<init>(Proc.java:216)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      	at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:130)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:59)
      	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:98)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:113)
      	at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1277)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1171)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
      	at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:46)
      	at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1277)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1171)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	... 24 more
      Finished: FAILURE
      

      I expect the build to error out, but something more helpful would be nice, like "The `sh` step is not supported on the Windows platform, please use `bat` or install Cygwin"

        Attachments

          Issue Links

            Activity

            Hide
            pausaca pau sabats added a comment -

            The error related with : 
            Cannot run program "nohup"
            means that it's searching for nohup.exe because is what jenkins requires when using 'sh' in the pipeline, so you can use nuhup.exe from here: "C:\Program Files\Git\usr\bin".

            Eventhough, what I have done in order to solve this issue is the following: Create a if else statement in your jenkinsfile that does:

                 if (isUnix()) --> sh "command"

                 else --> bat "command"

            doing so the pipeline running on agent windows will run as bat and this error no longer appears.

            Note: You can also use "tool config configuration" of jenkins and install tools from there. In case your sh commands were related with installation files

             

             

             

            Show
            pausaca pau sabats added a comment - The error related with :  Cannot run program "nohup" means that it's searching for nohup.exe because is what jenkins requires when using 'sh' in the pipeline, so you can use nuhup.exe from here: "C:\Program Files\Git\usr\bin". Eventhough, what I have done in order to solve this issue is the following: Create a if else statement in your jenkinsfile that does:      if (isUnix()) --> sh "command"      else --> bat "command" doing so the pipeline running on agent windows will run as bat and this error no longer appears. Note: You can also use "tool config configuration" of jenkins and install tools from there. In case your sh commands were related with installation files      
            Hide
            ethorsa ethorsa added a comment - - edited

            I had to set the PATH System variable on the computer before I could get sh to work on Windows.

            That's important, it doesn't work otherwise. Adding it to PATH from within the pipeline (eg. withEnv(...) or environment { ... }) doesn't work.

            Show
            ethorsa ethorsa added a comment - - edited I had to set the PATH System variable on the computer before I could get  sh  to work on Windows. That's important, it doesn't work otherwise. Adding it to PATH from within the pipeline (eg. withEnv(...)  or environment { ... }) doesn't work.
            Hide
            carelc Carel Combrink added a comment -

            I had to set the PATH System variable on the computer before I could get sh to work on Windows.

            Setting it in the  "List of variables" on the configuration page of the node in Jenkins allowed me to use the workaround as mentioned by Antony Gelberg
            Only once I set it in Windows and restarted the node could I use the "sh" command directly from within my script. 

            Show
            carelc Carel Combrink added a comment - I had to set the PATH System variable on the computer before I could get sh  to work on Windows. Setting it in the  "List of variables" on the configuration page of the node in Jenkins allowed me to use the workaround as mentioned by Antony Gelberg Only once I set it in Windows and restarted the node could I use the "sh" command directly from within my script. 
            Hide
            antgel Antony Gelberg added a comment - - edited

            Happening here as well with Git Bash, sadly the workarounds didn't work for me at all even when I altered PATH:

            pipeline {
              environment {
                PATH = "C:\\Program Files\\Git\\usr\\bin;C:\\Program Files\\Git\\bin;${env.PATH}"
              stages {
                stage('Sanity check') {
                  steps {
                    sh 'script/code_scan.sh'
                  }
                }
            ...
            

            I did bat 'sh -c script/code_scan.sh' instead ,which seems to work but is ugly and might hide gremlins.

            Errors were of the form:

            java.io.IOException: CreateProcess error=2, The system cannot find the file specified
            	at java.lang.ProcessImpl.create(Native Method)
            	at java.lang.ProcessImpl.<init>(Unknown Source)
            	at java.lang.ProcessImpl.start(Unknown Source)
            Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to windows-server-2012 (i-09233a1df87ee74c0)
            		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1737)
            		at hudson.remoting.UserResponse.retrieve(UserRequest.java:313)
            		at hudson.remoting.Channel.call(Channel.java:952)
            		at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1052)
            		at hudson.Launcher$ProcStarter.start(Launcher.java:449)
            		at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:186)
            		at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:71)
            		at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:176)
            		at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229)
            		at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
            		at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            		at sun.reflect.GeneratedMethodAccessor6254.invoke(Unknown Source)
            		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            		at java.lang.reflect.Method.invoke(Method.java:498)
            		at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
            		at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
            		at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
            		at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
            		at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
            		at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            		at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            		at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
            		at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
            		at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133)
            		at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
            		at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
            		at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)
            		at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
            		at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
            		at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
            		at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
            		at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
            		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            		at java.lang.reflect.Method.invoke(Method.java:498)
            		at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
            		at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
            		at com.cloudbees.groovy.cps.Next.step(Next.java:83)
            		at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
            		at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
            		at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
            		at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
            		at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
            		at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34)
            		at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59)
            		at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
            		at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58)
            		at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
            		at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332)
            		at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
            		at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
            		at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
            		at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
            		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            		at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
            		at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
            		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            		at java.lang.Thread.run(Thread.java:748)
            Caused: java.io.IOException: Cannot run program "nohup" (in directory "c:\jenkins\workspace\web"): CreateProcess error=2, The system cannot find the file specified
            	at java.lang.ProcessBuilder.start(Unknown Source)
            	at hudson.Proc$LocalProc.<init>(Proc.java:249)
            	at hudson.Proc$LocalProc.<init>(Proc.java:218)
            	at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
            	at hudson.Launcher$ProcStarter.start(Launcher.java:449)
            	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1299)
            	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1259)
            	at hudson.remoting.UserRequest.perform(UserRequest.java:210)
            	at hudson.remoting.UserRequest.perform(UserRequest.java:53)
            	at hudson.remoting.Request$2.run(Request.java:364)
            	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
            	at java.util.concurrent.FutureTask.run(Unknown Source)
            	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            	at java.lang.Thread.run(Unknown Source)
            
            Show
            antgel Antony Gelberg added a comment - - edited Happening here as well with Git Bash, sadly the workarounds didn't work for me at all even when I altered PATH : pipeline { environment { PATH = "C:\\Program Files\\Git\\usr\\bin;C:\\Program Files\\Git\\bin;${env.PATH}" stages { stage( 'Sanity check' ) { steps { sh 'script/code_scan.sh' } } ... I did bat 'sh -c script/code_scan.sh' instead ,which seems to work but is ugly and might hide gremlins. Errors were of the form: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to windows-server-2012 (i-09233a1df87ee74c0) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1737) at hudson.remoting.UserResponse.retrieve(UserRequest.java:313) at hudson.remoting.Channel.call(Channel.java:952) at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1052) at hudson.Launcher$ProcStarter.start(Launcher.java:449) at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:186) at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:71) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:176) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108) at sun.reflect.GeneratedMethodAccessor6254.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157) at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17) at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82) at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) Caused: java.io.IOException: Cannot run program "nohup" (in directory "c:\jenkins\workspace\web" ): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:249) at hudson.Proc$LocalProc.<init>(Proc.java:218) at hudson.Launcher$LocalLauncher.launch(Launcher.java:929) at hudson.Launcher$ProcStarter.start(Launcher.java:449) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1299) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1259) at hudson.remoting.UserRequest.perform(UserRequest.java:210) at hudson.remoting.UserRequest.perform(UserRequest.java:53) at hudson.remoting.Request$2.run(Request.java:364) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang. Thread .run(Unknown Source)
            Hide
            medianick Nick Jones added a comment - - edited

            With Git for Windows 2.16.2, I was able to add C:\Program Files\Git\usr\bin to the PATH (rather than C:\Program Files\Git\bin) and consequently my sh commands work in both FreeStyle and Pipeline builds. No mklink was necessary.

            Show
            medianick Nick Jones added a comment - - edited With Git for Windows 2.16.2, I was able to add C:\Program Files\Git\usr\bin to the PATH (rather than C:\Program Files\Git\bin) and consequently my sh commands work in both FreeStyle and Pipeline builds. No mklink was necessary.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                rtyler R. Tyler Croy
              • Votes:
                14 Vote for this issue
                Watchers:
                22 Start watching this issue

                Dates

                • Created:
                  Updated: