-
Bug
-
Resolution: Unresolved
-
Major
-
Windows
When executing a Groovy script build step, where one of the "Script parameters" arguments contains a "|", the Groovy build step fails. Sample Groovy script (for Groovy 3.x; comment out lines 2 and 3 for lower versions):
// Get dependencies @GrabConfig(systemClassLoader=true) @Grab('info.picocli:picocli-groovy:4.2.0') // Import external modules import groovy.cli.picocli.CliBuilder // Parse command line options def cli = new CliBuilder(name: 'theScript.groovy') cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show usage information') cli.r(type: String, longOpt: 'regex', required: true, args: 1, 'Regular expression (required)') def opts = cli.parse(args) opts || System.exit(1) if(opts.h) { cli.usage() System.exit(0) } println('Regex: ' + opts.r)
With "Script parameters" given as "-r foo|bar", this executes the script on Linux and thus prints
Regex: foo|bar
while it fails on Windows with
'bar' is not recognized as an internal or external command, operable program or batch file.
which means the script isn't even executed. I also tried to quote the regex with single or double quotes and escape the "|" with "^" (CMD) or "`" (Powershell) without any luck.
I would expect this to behave exactly the same on Linux and Windows.