Skip to content

Commit

Permalink
Revert "[JENKINS-62502] ContainerExecDecorator should escape double…
Browse files Browse the repository at this point in the history
… quotes"
  • Loading branch information
Vlatombe committed Jan 21, 2021
1 parent 665226a commit a6304fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,7 @@ static String[] getCommands(Launcher.ProcStarter starter, String containerWorkin

// BourneShellScript.launchWithCookie escapes $ as $$, we convert it to \$
for (String cmd : starter.cmds()) {
String fixedCommand = cmd.replaceAll("\\$\\$", Matcher.quoteReplacement("\\$"))
.replaceAll("\\\"", Matcher.quoteReplacement("\\\""));
String fixedCommand = cmd.replaceAll("\\$\\$", "\\\\\\$");

String oldRemoteDir = null;
FilePath oldRemoteDirFilepath = starter.pwd();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,7 @@ public void testCommandExecutionWithEscaping() throws Exception {
}

@Test
@Issue("JENKINS-62502")
public void testCommandExecutionEscapingDoubleQuotes() throws Exception {
ProcReturn r = execCommand(false, false, "sh", "-c", "cd /tmp; false; echo \"result is 1\" > test; cat /tmp/test");
assertTrue("Output should contain result: " + r.output,
Pattern.compile("^(result is 1)$", Pattern.MULTILINE).matcher(r.output).find());
assertEquals(0, r.exitCode);
assertFalse(r.proc.isAlive());
}

@Test
public void testCommandExecutionOutput() throws Exception {
public void testCommandExecutionOutput() throws Exception {
String testString = "Should appear once";

// Check output with quiet=false
Expand Down

0 comments on commit a6304fb

Please sign in to comment.