Skip to content

Commit

Permalink
scinit bugfix when using quoted arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePrez committed May 15, 2021
1 parent f817043 commit 70a763c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scinit.bin
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/QOpenSys/pkgs/bin/bash
export LC_ALL=EN_US.UTF-8
exec /QOpenSys/pkgs/lib/jvm/openjdk-11/bin/java -cp $(dirname $0)/../lib/sc/sc.jar jesseg.ibmi.opensource.ServiceInit $*
exec /QOpenSys/pkgs/lib/jvm/openjdk-11/bin/java -cp $(dirname $0)/../lib/sc/sc.jar jesseg.ibmi.opensource.ServiceInit $@
12 changes: 9 additions & 3 deletions src/main/java/jesseg/ibmi/opensource/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,16 @@ String getCode() {
private static final String TERM_COLOR_RESET = "\u001B[0m";

@SafeVarargs
public static <T extends Object> String arrayToSpaceSeparatedString(final T... constants) {
public static <T extends Object> String arrayToSpaceSeparatedString(final T... _arr) {
final StringBuilder ret = new StringBuilder();
for (final T o : constants) {
ret.append("" + o);
for (final T o : _arr) {
final String str = ("" + o);
if (str.matches("^[\\w\\.\\-]+$")) {
ret.append(str);
} else {
char delim = str.contains("'") ? '\"' : '\'';
ret.append("" + delim + str + delim);
}
ret.append(' ');
}
return ret.toString().trim();
Expand Down

0 comments on commit 70a763c

Please sign in to comment.