the problem is needing a dirty hack
(building a list and swapping the svn executable for COMSPEC when using
gradle's exec command)
on windows, because, on windows, exec does not return the correct exit
value.
It always returns 0

For example, my current work around looks a bit like this:

 if (System.getProperty("os.name")?.toLowerCase()?.indexOf("windows") !=
-1){
 svnExecutor = System.getenv("COMSPEC")
svnCommandExtras += ['/c', 'svn']
 }
else // no extras needed for linux
 svnExecutor = 'svn'



result = exec {
 executable = svnExecutor
ignoreExitValue = true
args = svnCommandExtras + ['export',
"${svn_repo_root}/path/settings.gradle", file.getAbsolutePath(),
'--username', "${svn_user}", '--password', "${svn_pass}"]
 }



god help me if I need to execute other executables other than svn






On 22 June 2011 18:14, Steven Devijver <sdevij...@yahoo.fr> wrote:

>  > Now I have this problem again, and can not solve it using the gradle
> launcher, because it is not Gradle I am launching .... it is Subversion; see
> here below
> >
> >  result = exec {
> > executable = 'svn'
> > ignoreExitValue = true
> > args = ['info', "${svn_repo_root}/${projectLoc}/build.gradle",
> > '--username', "${svn_user}", '--password', "${svn_pass}"]
> > }
> > if (result.getExitValue()==0){
> >                                        // do something
> >                               }
> >                               else // do something else
>
> What is the problem exactly?
>
> Steven
>
> ------------------------------
> *De :* Sean Van Buggenum <sva...@gmail.com>
> *À :* user@gradle.codehaus.org
> *Envoyé le :* Mercredi 22 Juin 2011 8h44
> *Objet :* [gradle-user] exit value from exec command on windows - running
> subversion from gradle
>
> Hi all,
>
> i'm looking for non-OS specific solution to my problem with windows and the
> exit value on the exec command.
>
> I had this problem previously, using gradle on windows, but then it was
> solved brilliantly by a suggestion by a helpful user, Jesper Skov, who, when
> he realized I wanted to run a gradle instance from gradle, suggested that I
> use the Gradle Launcher. This worked perfectly. Not only did it solve my
> problems on windows, but it was a general solution that allowed me to run my
> gradle build script on linux (my native OS) as well.
>
> Now I have this problem again, and can not solve it using the gradle
> launcher, because it is not Gradle I am launching .... it is Subversion; see
> here below
>
> result = exec {
> executable = 'svn'
>  ignoreExitValue = true
> args = ['info', "${svn_repo_root}/${projectLoc}/build.gradle",
>  '--username', "${svn_user}", '--password', "${svn_pass}"]
> }
>  if (result.getExitValue()==0){
>                                          // do something
>                                }
>                                else // do something else
>
>
> Apparently (and I am no windows expert) I need to, if I want to get the
> exit value from the exec command on windows, use the COMSPEC thingymagig.
>
> %COMSPEC% /c svn
>
> ??
>
> The problem with this is I don't just want to run this on windows, but on
> linux as well (without having to modify the script each time).
>
> Is there an OS transparent way of getting my exit value?
>
> Alternatively, is there any way of getting gradle to tell you (a project
> property or so) which OS you are currently running on?
>
> Also, i'm not one for windows...
>
> Can I count on this COMSPEC being present on windows? If I need to use it,
> what syntax should I use, in the context of the 'exec' command on gradle.
>
> thanks for any help!
>
> sean
>
>
>
>
>
>
>
>
>
>
>
>

Reply via email to