@@ -22,29 +22,33 @@ public interface MatlabBuild {
2222 * This Method decorates the launcher with MATLAB command provided and returns the Process
2323 * object to launch MATLAB with appropriate startup options like -r or -batch
2424 *
25- * @param matlabLauncher current build launcher
2625 * @param workspace Current build workspace
2726 * @param launcher Current build launcher
2827 * @param listener Current build listener
28+ * @param envVars Environment variables of the current build
2929 * @param matlabCommand MATLAB command to execute on shell
3030 * @return matlabLauncher returns the process launcher to run MATLAB commands
3131 */
32- default ProcStarter getProcessToRunMatlabCommand (ProcStarter matlabLauncher , FilePath workspace ,
33- Launcher launcher , TaskListener listener , String matlabCommand , String uniqueName )
32+ default ProcStarter getProcessToRunMatlabCommand (FilePath workspace ,
33+ Launcher launcher , TaskListener listener , EnvVars envVars , String matlabCommand , String uniqueName )
3434 throws IOException , InterruptedException {
3535 // Get node specific tmp directory to copy matlab runner script
3636 String tmpDir = getNodeSpecificTmpFolderPath (workspace );
3737 FilePath targetWorkspace = new FilePath (launcher .getChannel (), tmpDir );
38+ ProcStarter matlabLauncher ;
3839 if (launcher .isUnix ()) {
3940 final String runnerScriptName = uniqueName + "/run_matlab_command.sh" ;
41+ matlabLauncher = launcher .launch ().envs (envVars );
4042 matlabLauncher .cmds (tmpDir + "/" + runnerScriptName , matlabCommand ).stdout (listener );
4143
4244 // Copy runner .sh for linux platform in workspace.
4345 copyFileInWorkspace (MatlabBuilderConstants .SHELL_RUNNER_SCRIPT , runnerScriptName ,
4446 targetWorkspace );
4547 } else {
4648 final String runnerScriptName = uniqueName + "\\ run_matlab_command.bat" ;
47- matlabLauncher .cmds ("cmd.exe" ,"/C" ,tmpDir + "\\ " + runnerScriptName , "\" " + matlabCommand + "\" " )
49+ launcher = launcher .decorateByPrefix ("cmd.exe" , "/C" );
50+ matlabLauncher = launcher .launch ().envs (envVars );
51+ matlabLauncher .cmds (tmpDir + "\\ " + runnerScriptName , "\" " + matlabCommand + "\" " )
4852 .stdout (listener );
4953 // Copy runner.bat for Windows platform in workspace.
5054 copyFileInWorkspace (MatlabBuilderConstants .BAT_RUNNER_SCRIPT , runnerScriptName ,
0 commit comments