mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +00:00
GP-5015: post-review
GP-5015: fix for spaces issue
This commit is contained in:
parent
a9d2515610
commit
100958880b
@ -4,9 +4,9 @@
|
|||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -127,33 +127,27 @@ public class ShellUtils {
|
|||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
StringBuilder line = new StringBuilder(args.get(0));
|
StringBuilder line = new StringBuilder(genreateArgument(args.get(0)));
|
||||||
for (int i = 1; i < args.size(); i++) {
|
for (int i = 1; i < args.size(); i++) {
|
||||||
String a = args.get(i);
|
String a = args.get(i);
|
||||||
if (a.contains(" ")) {
|
line.append(" " + genreateArgument(a));
|
||||||
if (a.contains("\"")) {
|
|
||||||
if (a.contains("'")) {
|
|
||||||
line.append(" \"");
|
|
||||||
line.append(a.replace("\"", "\\\""));
|
|
||||||
line.append("\"");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
line.append(" '");
|
|
||||||
line.append(a);
|
|
||||||
line.append("'");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
line.append(" \"");
|
|
||||||
line.append(a);
|
|
||||||
line.append("\"");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
line.append(" ");
|
|
||||||
line.append(a);
|
|
||||||
}
|
}
|
||||||
return line.toString();
|
return line.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String genreateArgument(String a) {
|
||||||
|
if (a.contains(" ")) {
|
||||||
|
if (a.contains("\"")) {
|
||||||
|
if (a.contains("'")) {
|
||||||
|
return "\"" + a.replace("\"", "\\\"") + "\"";
|
||||||
|
}
|
||||||
|
return "'" + a + "'";
|
||||||
|
}
|
||||||
|
return "\"" + a + "\"";
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
public static String generateEnvBlock(Map<String, String> env) {
|
public static String generateEnvBlock(Map<String, String> env) {
|
||||||
return env.entrySet()
|
return env.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
|
Loading…
Reference in New Issue
Block a user