[ 
https://issues.apache.org/jira/browse/NIFI-604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14579805#comment-14579805
 ] 

Mark Payne commented on NIFI-604:
---------------------------------

Ricky,

This patch does indeed allow for a semi-colon to be used as part of an 
argument. However, it has the side effect of preventing an argument from ending 
with a backslash. So for example, I tried with the command "cmd" and the 
command args "/C;ls;C:\;C:\temp" So with the new change it will interpret the 
'ls' command to have one argument: "C:;C:\temp" but I want it to interpret it 
as two separate arguments: "C:\" and "C:\temp". If we use two backslashes 
before the semicolon we end up with 1 arg still: "C:\;C:\temp" which is still 
not what i want.

I think maybe we should go a slightly different route here. Either A) allow 
user to specify the delimiter (default would be semicolon) or B) allow 
arguments to be quoted so that semicolons are not counted as delimiters if they 
are within quotes. We use this approach in the ExecuteProcess processor. Since 
the code is mostly written (may need to be refactored to take an arbitrary 
delimiter instead of using a space as a delimiter) that may be the easiest 
approach. We could also combine the two approaches, allowing the user to 
specify and delimiter and also allowing arguments to be quoted.

Thoughts?

Thanks
-Mark


> ExecuteStreamCommand does not support arguments with semicolons 
> ----------------------------------------------------------------
>
>                 Key: NIFI-604
>                 URL: https://issues.apache.org/jira/browse/NIFI-604
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.1.0
>            Reporter: Ricky Saltzer
>            Assignee: Mark Payne
>             Fix For: 0.2.0
>
>         Attachments: NIFI-604.1.patch, NIFI-604.2.patch
>
>
> The following code in ExecuteStreamCommand assumes you're not passing 
> semicolons within your argument. This is a problem for people who need to 
> pass semicolons to the executing program as part of the argument. 
> {code}
> 224            for (String arg : commandArguments.split(";")) { 
> {code}
> To allow for escaped semicolons, I propose we change this to the following 
> regex.
> {code}
> 224            for (String arg : commandArguments.split("[^\\];")) { 
> {code}
> *or*... could we just change the way arguments are passed to make it more 
> similar to how ExecuteCommand works? The whole semicolon per argument took 
> some getting used to, and doesn't seem very intuitive. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to