Skip to content

Commit

Permalink
Merge pull request jenkinsci#937 from jenkinsci/revert-924-JENKINS-62502
Browse files Browse the repository at this point in the history
[JENKINS-64675] Revert "[JENKINS-62502] `ContainerExecDecorator` should escape double quotes"
  • Loading branch information
Vlatombe committed Jan 21, 2021
2 parents 665226a + a6304fb commit 5d60a24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
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
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 5d60a24

Please sign in to comment.