Skip to content

CommandLineUtils.translateCommandline() splits arguments only at space #329

Description

@HannesWell

The utility methods CommandLineUtils.translateCommandline() currently splits arguments only at spaces:

StringTokenizer tok = new StringTokenizer(toProcess, "\"\' ", true);

But for example the bash reference manual indicates that space, tab and newline is considered as separator:
https://www.gnu.org/software/bash/manual/bash.html#Word-Splitting-1

If IFS is unset, word splitting behaves as if its value were <space><tab><newline>, and treats these characters as IFS whitespace.

As far as I can tell, Windows cmd behaves similar with respect to tab. I'm not sure about powershell.

Especially not being able to use tabs, can make using this difficult in CI environments.

Would you be willing to accept a patch to enhance this method to split at least on tabs too, maybe even newline (\n and \r)?
Or at least an overload that allows custom separators or a second method with this extended list of separator chars?

I can provider corresponding PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions