I have a @Test method written in java which calls a shell script. The shell script contains vimdiff command used for generating code comparison between two html files.
When I run this test method from jenkins, the shell script is getting executed. But the vimdiff command is not getting executed.
Java method which calls shell script
try {
File[] uiDiffDir = getFiles();
for (File file : uiDiffDir) {
String[] cmd = {"sh", shellScriptPath, beforeHtmlPath + file.getName(), afterHtmlPath + file.getName(),
codeComparisonPath + file.getName()};
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(
p.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
shell.sh
vimdiff -c 'set foldlevel=9999' $1 $2 -c TOhtml -c 'w! '"$3"'' -c 'qa!'
This method is working perfectly from my intellij but from inside jenkins vimdiff is not working. From jenkins, I verified the arguments are getting passed correctly using echo statements. So thats not an issue. So my question is, does vimdiff work from inside jenkins? Can someone help me with this question. I am little confused.