Skip to content

Commit 5891b75

Browse files
committed
enclose directory in single quotes
1 parent 8784df1 commit 5891b75

File tree

1 file changed

+9
-8
lines changed
  • opengrok-indexer/src/main/java/org/opengrok/indexer/util

1 file changed

+9
-8
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/util/Executor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2019, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.util;
@@ -184,7 +184,7 @@ public int exec(final boolean reportExceptions, StreamHandler handler) {
184184
envStr = " with environment: " + envMap.toString();
185185
}
186186
LOGGER.log(Level.FINE,
187-
"Executing command [{0}] in directory {1}{2}",
187+
"Executing command [{0}] in directory ''{1}''{2}",
188188
new Object[] {cmd_str, dir_str, envStr});
189189

190190
Process process = null;
@@ -201,7 +201,7 @@ public int exec(final boolean reportExceptions, StreamHandler handler) {
201201
} catch (IOException ex) {
202202
if (reportExceptions) {
203203
LOGGER.log(Level.SEVERE,
204-
"Error while executing command [{0}] in directory {1}",
204+
"Error while executing command [{0}] in directory ''{1}''",
205205
new Object[] {cmd_str, dir_str});
206206
LOGGER.log(Level.SEVERE, "Error during process pipe listening", ex);
207207
}
@@ -220,7 +220,7 @@ public int exec(final boolean reportExceptions, StreamHandler handler) {
220220
timer.schedule(new TimerTask() {
221221
@Override public void run() {
222222
LOGGER.log(Level.WARNING,
223-
String.format("Terminating process of command [%s] in directory %s " +
223+
String.format("Terminating process of command [%s] in directory '%s' " +
224224
"due to timeout %d seconds", cmd_str, dir_str, timeout / 1000));
225225
proc.destroy();
226226
}
@@ -232,10 +232,10 @@ public int exec(final boolean reportExceptions, StreamHandler handler) {
232232
ret = process.waitFor();
233233

234234
stat.report(LOGGER, Level.FINE,
235-
String.format("Finished command [%s] in directory %s with exit code %d", cmd_str, dir_str, ret),
235+
String.format("Finished command [%s] in directory '%s' with exit code %d", cmd_str, dir_str, ret),
236236
"executor.latency");
237237
LOGGER.log(Level.FINE,
238-
"Finished command [{0}] in directory {1} with exit code {2}",
238+
"Finished command [{0}] in directory ''{1}'' with exit code {2}",
239239
new Object[] {cmd_str, dir_str, ret});
240240

241241
// Wait for the stderr read-out thread to finish the processing and
@@ -272,8 +272,9 @@ public int exec(final boolean reportExceptions, StreamHandler handler) {
272272
StringBuilder msg = new StringBuilder("Non-zero exit status ")
273273
.append(ret).append(" from command [")
274274
.append(cmd_str)
275-
.append("] in directory ")
276-
.append(dir_str);
275+
.append("] in directory '")
276+
.append(dir_str).
277+
append("'");
277278
if (stderr != null && stderr.length > 0) {
278279
msg.append(": ");
279280
if (stderr.length > MAX_MSG_SZ) {

0 commit comments

Comments
 (0)