mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-16 18:04:52 +00:00
Command line arguments with comma must be quoted on windows
This commit is contained in:
parent
283eff13aa
commit
c739d9af2b
@ -391,6 +391,17 @@ class ClusterFormationTasks {
|
|||||||
return configureExecTask(name, project, setup, node, args)
|
return configureExecTask(name, project, setup, node, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Surround strings that contains a comma with double quotes **/
|
||||||
|
private static String escapeComma(Object o) {
|
||||||
|
if (o instanceof String) {
|
||||||
|
String s = (String)o
|
||||||
|
if (s.indexOf(',') != -1) {
|
||||||
|
return "\"${s}\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
/** Adds a task to execute a command to help setup the cluster */
|
/** Adds a task to execute a command to help setup the cluster */
|
||||||
static Task configureExecTask(String name, Project project, Task setup, NodeInfo node, Object[] execArgs) {
|
static Task configureExecTask(String name, Project project, Task setup, NodeInfo node, Object[] execArgs) {
|
||||||
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) {
|
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) {
|
||||||
@ -398,10 +409,13 @@ class ClusterFormationTasks {
|
|||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
executable 'cmd'
|
executable 'cmd'
|
||||||
args '/C', 'call'
|
args '/C', 'call'
|
||||||
|
// On Windows the comma character is considered a parameter separator:
|
||||||
|
// argument that contains a comma must be quoted
|
||||||
|
args execArgs.collect { a -> escapeComma(a) }
|
||||||
} else {
|
} else {
|
||||||
executable 'sh'
|
executable 'sh'
|
||||||
|
args execArgs
|
||||||
}
|
}
|
||||||
args execArgs
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user