You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pavel (JIRA)" <ji...@apache.org> on 2015/09/06 20:05:45 UTC

[jira] [Commented] (GROOVY-7545) Incorrect handling of quotes in executed strings

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

Pavel commented on GROOVY-7545:
-------------------------------

https://blogs.oracle.com/thejavatutorials/entry/changes_to_runtime_exec_problems suggest use
{code}
Runtime.getRuntime().exec("cmd /C log.bat \">error<\"") 
{code}
as correct for windows. What is the main differences in platforms there? Why in windows allowed arguments in quotes (did not try), but on Linux is not?

But you are right it is mostly java problem then Groovy itself.

What about suggestion try tokenize strings... Can't be there uses same mechanism as groovy uses to parse all type of string in language parser?

> Incorrect handling of quotes in executed strings
> ------------------------------------------------
>
>                 Key: GROOVY-7545
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7545
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Pavel
>
> {code}
> cat execute.bug.groovy
> #!/bin/env groovy
> String cmd = "sh -c 'echo test' "
> println "cmd: $cmd"
> def proc = cmd.execute()
> proc.waitForProcessOutput(System.out, System.err)
> {code}
> {code}
> $ LANG=en_US.utf8 ./execute.bug.groovy
> cmd: sh -c 'echo test' 
> test': -c: line 0: unexpected EOF while looking for matching `''
> test': -c: line 1: syntax error: unexpected end of file
> {code}



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