|
31 | 31 | import hudson.ExtensionPoint; |
32 | 32 | import hudson.FilePath; |
33 | 33 | import hudson.Launcher; |
| 34 | +import hudson.Launcher.ProcStarter; |
34 | 35 | import hudson.model.AbstractProject; |
35 | 36 | import hudson.model.Describable; |
36 | 37 | import hudson.model.Descriptor; |
@@ -389,22 +390,21 @@ private int execMatlabCommand(Run<?, ?> build, FilePath workspace, Launcher laun |
389 | 390 | //Copy MATLAB scratch file into the workspace |
390 | 391 | copyMatlabScratchFileInWorkspace(MATLAB_RUNNER_RESOURCE, MATLAB_RUNNER_TARGET_FILE, |
391 | 392 | workspace, getClass().getClassLoader()); |
| 393 | + ProcStarter matlabLauncher; |
392 | 394 | try { |
393 | 395 | MatlabReleaseInfo rel = new MatlabReleaseInfo(getLocalMatlab()); |
| 396 | + matlabLauncher = launcher.launch().pwd(workspace).envs(env); |
394 | 397 | if (rel.verLessThan(BASE_MATLAB_VERSION_BATCH_SUPPORT)) { |
395 | 398 | ListenerLogDecorator outStream = new ListenerLogDecorator(listener); |
396 | | - return launcher.launch().pwd(workspace) |
397 | | - .envs(env) |
398 | | - .cmds(constructDefaultMatlabCommand(isLinuxLauncher)).stderr(outStream) |
399 | | - .join(); |
| 399 | + matlabLauncher = matlabLauncher.cmds(constructDefaultMatlabCommand(isLinuxLauncher)).stderr(outStream); |
400 | 400 | } else { |
401 | | - return launcher.launch().pwd(workspace).envs(env).cmds(constructMatlabCommandWithBatch()) |
402 | | - .stdout(listener).join(); |
| 401 | + matlabLauncher = matlabLauncher.cmds(constructMatlabCommandWithBatch()).stdout(listener); |
403 | 402 | } |
404 | 403 | } catch (MatlabVersionNotFoundException e) { |
405 | 404 | listener.getLogger().println(e.getMessage()); |
406 | 405 | return 1; |
407 | 406 | } |
| 407 | + return matlabLauncher.join(); |
408 | 408 | } |
409 | 409 |
|
410 | 410 | public List<String> constructMatlabCommandWithBatch() { |
|
0 commit comments