@@ -33,7 +33,7 @@ default ProcStarter getProcessToRunMatlabCommand(FilePath workspace, Launcher la
3333 TaskListener listener , EnvVars envVars , String matlabCommand , String uniqueName )
3434 throws IOException , InterruptedException {
3535 // Get node specific tmp directory to copy matlab runner script
36- String tmpDir = getNodeSpecificTmpFolderPath ();
36+ String tmpDir = getNodeSpecificTmpFolderPath (workspace );
3737 FilePath targetWorkspace = new FilePath (launcher .getChannel (), tmpDir );
3838 ProcStarter matlabLauncher ;
3939 if (launcher .isUnix ()) {
@@ -70,9 +70,12 @@ default void copyFileInWorkspace(String sourceFile, String targetFile, FilePath
7070 targetFilePath .chmod (0755 );
7171 }
7272
73- default FilePath getFilePathForUniqueFolder (Launcher launcher , String uniqueName )
73+ default FilePath getFilePathForUniqueFolder (Launcher launcher , String uniqueName , FilePath workspace )
7474 throws IOException , InterruptedException {
75- Computer cmp = Computer .currentComputer ();
75+ /*Use of Computer is not recommended as jenkins hygeine for pipeline support
76+ * https://javadoc.jenkins-ci.org/jenkins/tasks/SimpleBuildStep.html */
77+
78+ Computer cmp = workspace .toComputer ();
7679 String tmpDir = (String ) cmp .getSystemProperties ().get ("java.io.tmpdir" );
7780 if (launcher .isUnix ()) {
7881 tmpDir = tmpDir + "/" + uniqueName ;
@@ -82,8 +85,8 @@ default FilePath getFilePathForUniqueFolder(Launcher launcher, String uniqueName
8285 return new FilePath (launcher .getChannel (), tmpDir );
8386 }
8487
85- default String getNodeSpecificTmpFolderPath () throws IOException , InterruptedException {
86- Computer cmp = Computer . currentComputer ();
88+ default String getNodeSpecificTmpFolderPath (FilePath workspace ) throws IOException , InterruptedException {
89+ Computer cmp = workspace . toComputer ();
8790 String tmpDir = (String ) cmp .getSystemProperties ().get ("java.io.tmpdir" );
8891 return tmpDir ;
8992 }
0 commit comments