Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 7ab150f

Browse files
committed
Custom command is run after escaping imbalanced double quotes
1 parent 8157d26 commit 7ab150f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/com/mathworks/ci/MatlabBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ private String[] getRunnerSwitch() {
471471
+ getTestRunTypeList().getBooleanByName("taCoberturaChkBx")
472472
+ ")),catch e,disp(getReport(e,'extended')),exit(1),end";
473473
} else {
474-
runCommand = "try," + this.getTestRunTypeList().getStringByName("customMatlabCommand")
475-
+ ",catch e,disp(getReport(e,'extended')),exit(1),end,exit";
474+
runCommand = "try,eval(\"" + this.getTestRunTypeList().getStringByName("customMatlabCommand").replaceAll("\"","\"\"")
475+
+ "\"),catch e,disp(getReport(e,'extended')),exit(1),end,exit";
476476
}
477477

478478
final String[] runnerSwitch = {"-r", runCommand};

src/test/java/com/mathworks/ci/MatlabBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public void verifyCustomCommandInvoked() throws Exception {
267267
project.getBuildersList().add(this.matlabBuilder);
268268
FreeStyleBuild build = project.scheduleBuild2(0).get();
269269
jenkins.assertLogContains("-r", build);
270-
jenkins.assertLogContains("try,runtests", build);
270+
jenkins.assertLogContains("try,eval", build);
271271
}
272272

273273
/*

0 commit comments

Comments
 (0)