Skip to content

Commit

Permalink
Merge pull request #97 from thevpc/fix/commandline-formatter-issue
Browse files Browse the repository at this point in the history
Use double quotes instead of simple ones for arguments escaping in Shell
  • Loading branch information
thevpc committed Oct 30, 2021
2 parents 58cd334 + b63c328 commit 3769736
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public String escapeArguments(String[] args, NutsCommandLineShellOptions options

public String escapeArgument(String arg, NutsCommandLineShellOptions options) {
if(arg == null || arg.isEmpty()){
return "''";
return "\"\"";
}
if(options==null){
options=new NutsCommandLineShellOptions();
Expand Down Expand Up @@ -373,7 +373,7 @@ public String escapeArgument(String arg, NutsCommandLineShellOptions options) {
}
case REQUIRE_QUOTES:{
StringBuilder sb=new StringBuilder();
sb.append("'");
sb.append("\"");
for (char c : arg.toCharArray()) {
switch (c){
case '\\':
Expand All @@ -396,7 +396,7 @@ public String escapeArgument(String arg, NutsCommandLineShellOptions options) {
}
}
}
sb.append("'");
sb.append("\"");
return sb.toString();
}
default:{
Expand Down

0 comments on commit 3769736

Please sign in to comment.