Open drjrm3 opened 6 years ago
As a workaround, you can use double quotes ("
) to quote the command in baseCommand
, e.g. baseCommand: ["awk", "'{print $2}'"]
In deed, this is a bug, we will fix it finally
Thanks for the response, this has been my workaround for the above example. However, if the awk command contains quotes itself:
baseCommand: [awk, "'{$5=$6=$7=$8=""; print $0}'"]
cwltool fails causing cwlexec to not even start the job (because the input failed validation).
Syntax error while parsing a flow sequence File:///awkColumnDisplace.cwl", line 22, column 14 expected ',' or ']', but got '<scalar>'
@drkennetz and @drjrm3
cwlexec use jackson to parse the cwl definition/inputs files, but jackson doesn't seem to work very well when a field has the single quotes ('
), so we suggest you use double quotes ("
) to quote the command options
https://github.com/FasterXML/jackson-core/pull/235 https://github.com/json-path/JsonPath/issues/275
@drkennetz
For your case, you should escape the double quotes ("
) in your string, e.g.
baseCommand: [awk, "'{$5=$6=$7=$8=\"\"; print $0}'"]
This will work well
Hello,
I am having a related issue, where having an input as a string
type builds the command incorrectly. I have attached a simple case where there are 3 input examples given. The first two cause an error with my shell script because it expects only two fields.
message: hello world
Expected out_1.txt: hello world
Actual out_1.txt: Errors out because the input needs quotes
message: "hello world"
Expected out_2.txt: hello world
Actual out_2.txt: Errors out because the input needs quotes and cwlexec gets rid of them
message: "'hello world'"
Expected out_3.txt: 'hello world'
Actual out_3.txt: hello world
So the workaround given does get around the quotes issue and it will work, but the output is different than the expected output which causes reproducibility issues if I want to use the script with cwlexec and cwltool. Thanks!
@biokcb Thanks for your cases, they are good cases for us, the quotes problem is more trick :( , but I think you may follow below rules:
message: hello world
equals
message: "hello world"
and equals
message: 'hello world'
all of above definitions will get a string that does not has any quotes (hello world
)
If you want to define a string that has double quotes ("hello world"
), you need define it to
message: '"hello world"'
or
message: "\"hello world\""
and if you want to define a string that has single quotes ('hello world'
), you need define it to
message: "'hello world'"
We have a simple workflow which uses
baseCommand: [awk, '{print $2}']
and the interpreted command does not keep the'
's. Instead, it interprets the baseCommand as"baseCommand" : [ "awk", "{print $2}" ],
(line 40 in the attachedoutfile.txt
) and attempts to executeawk {print $2}
(line 148) which fails. BaseCommandError.tar.gz