java.io.IOException: Cannot run program "source" (in directory "<my worspace>"): java.io.IOException: error=2, No such file or directory

Jenkins JIRA | jasperlj | 6 years ago
  1. 0

    I overwrited buildCommandLine in hudson.tasks.Shell to execute script by "source" command: return new Shell(script) { @Override protected String[] buildCommandLine(FilePath script) { if(command.startsWith("#!")) { // interpreter override int end = command.indexOf('\n'); if(end<0) end=command.length(); List<String> args = new ArrayList(); //args.addAll(Arrays.asList(Util.tokenize(command.substring(0,end).trim()))); args.add("source"); args.add(script.getRemote()); //args.set(0,args.get(0).substring(2)); // trim off "#!" return args.toArray(new String[args.size()]); } else return new String[] { getDescriptor().getShellOrDefault(),"-xe",script.getRemote()}; } } Build log says: FATAL: command execution failed java.io.IOException: Cannot run program "source" (in directory "<my worspace>"): java.io.IOException: error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:459) at hudson.Proc$LocalProc.<init>(Proc.java:192) at hudson.Proc$LocalProc.<init>(Proc.java:164) at hudson.Launcher$LocalLauncher.launch(Launcher.java:638) at hudson.Launcher$ProcStarter.start(Launcher.java:273) at hudson.Launcher$ProcStarter.join(Launcher.java:280) at com.nokia.hudson.s40isattcn.S40IsattcnBuilder$1.perform(S40IsattcnBuilder.java:901) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58) at com.nokia.hudson.s40isattcn.S40IsattcnBuilder.perform(S40IsattcnBuilder.java:373) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601) at hudson.model.Build$RunnerImpl.build(Build.java:174) at hudson.model.Build$RunnerImpl.doRun(Build.java:138) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1273) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:129) Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.<init>(UNIXProcess.java:148) at java.lang.ProcessImpl.start(ProcessImpl.java:65) at java.lang.ProcessBuilder.start(ProcessBuilder.java:452) ... 17 more But "source" is Linux build-in command. I think it's a bug.

    Jenkins JIRA | 6 years ago | jasperlj
    java.io.IOException: Cannot run program "source" (in directory "<my worspace>"): java.io.IOException: error=2, No such file or directory
  2. 0

    I overwrited buildCommandLine in hudson.tasks.Shell to execute script by "source" command: return new Shell(script) { @Override protected String[] buildCommandLine(FilePath script) { if(command.startsWith("#!")) { // interpreter override int end = command.indexOf('\n'); if(end<0) end=command.length(); List<String> args = new ArrayList(); //args.addAll(Arrays.asList(Util.tokenize(command.substring(0,end).trim()))); args.add("source"); args.add(script.getRemote()); //args.set(0,args.get(0).substring(2)); // trim off "#!" return args.toArray(new String[args.size()]); } else return new String[] { getDescriptor().getShellOrDefault(),"-xe",script.getRemote()}; } } Build log says: FATAL: command execution failed java.io.IOException: Cannot run program "source" (in directory "<my worspace>"): java.io.IOException: error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:459) at hudson.Proc$LocalProc.<init>(Proc.java:192) at hudson.Proc$LocalProc.<init>(Proc.java:164) at hudson.Launcher$LocalLauncher.launch(Launcher.java:638) at hudson.Launcher$ProcStarter.start(Launcher.java:273) at hudson.Launcher$ProcStarter.join(Launcher.java:280) at com.nokia.hudson.s40isattcn.S40IsattcnBuilder$1.perform(S40IsattcnBuilder.java:901) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58) at com.nokia.hudson.s40isattcn.S40IsattcnBuilder.perform(S40IsattcnBuilder.java:373) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601) at hudson.model.Build$RunnerImpl.build(Build.java:174) at hudson.model.Build$RunnerImpl.doRun(Build.java:138) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1273) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:129) Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.<init>(UNIXProcess.java:148) at java.lang.ProcessImpl.start(ProcessImpl.java:65) at java.lang.ProcessBuilder.start(ProcessBuilder.java:452) ... 17 more But "source" is Linux build-in command. I think it's a bug.

    Jenkins JIRA | 6 years ago | jasperlj
    java.io.IOException: Cannot run program "source" (in directory "<my worspace>"): java.io.IOException: error=2, No such file or directory
  3. 0

    jenkins | Blog of Annoying Technical Details

    wordpress.com | 1 year ago
    java.io.IOException: Cannot run program "/opt/android-sdk/platform-tools/aapt" (in directory ": java.io.IOException: error=2, No such file or directory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Cannot run program “/opt/android-sdk/platform-tools/aapt” | Blog of Annoying Technical Details

    wordpress.com | 7 months ago
    java.io.IOException: Cannot run program "/opt/android-sdk/platform-tools/aapt" (in directory ": java.io.IOException: error=2, No such file or directory
  6. 0

    android | Blog of Annoying Technical Details

    wordpress.com | 6 months ago
    java.io.IOException: Cannot run program "/opt/android-sdk/platform-tools/aapt" (in directory ": java.io.IOException: error=2, No such file or directory

  1. eti22 1 times, last 1 month ago
  2. asdasd 24 times, last 3 months ago
  3. rexgreenza 8 times, last 3 months ago
  4. Benj-AD 1 times, last 4 months ago
  5. Akshay 4 times, last 6 months ago
95 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    java.io.IOException: error=2, No such file or directory

    at java.lang.UNIXProcess.<init>()
  2. Java RT
    ProcessBuilder.start
    1. java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
    2. java.lang.ProcessImpl.start(ProcessImpl.java:65)
    3. java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    3 frames
  3. Hudson
    Launcher$ProcStarter.join
    1. hudson.Proc$LocalProc.<init>(Proc.java:192)
    2. hudson.Proc$LocalProc.<init>(Proc.java:164)
    3. hudson.Launcher$LocalLauncher.launch(Launcher.java:638)
    4. hudson.Launcher$ProcStarter.start(Launcher.java:273)
    5. hudson.Launcher$ProcStarter.join(Launcher.java:280)
    5 frames
  4. com.nokia.hudson
    S40IsattcnBuilder$1.perform
    1. com.nokia.hudson.s40isattcn.S40IsattcnBuilder$1.perform(S40IsattcnBuilder.java:901)
    1 frame
  5. Hudson
    CommandInterpreter.perform
    1. hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58)
    1 frame
  6. com.nokia.hudson
    S40IsattcnBuilder.perform
    1. com.nokia.hudson.s40isattcn.S40IsattcnBuilder.perform(S40IsattcnBuilder.java:373)
    1 frame
  7. Hudson
    Executor.run
    1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    2. hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601)
    3. hudson.model.Build$RunnerImpl.build(Build.java:174)
    4. hudson.model.Build$RunnerImpl.doRun(Build.java:138)
    5. hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
    6. hudson.model.Run.run(Run.java:1273)
    7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    8. hudson.model.ResourceController.execute(ResourceController.java:88)
    9. hudson.model.Executor.run(Executor.java:129)
    9 frames