ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Execute.java
Date Fri, 30 Jan 2004 15:37:08 GMT
bodewig     2004/01/30 07:37:08

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs Execute.java
  Log:
  Fail with a useful error message when the user asks us to fork a
  process in a directory that doesn't exist.
  
  PR: 25455
  
  Revision  Changes    Path
  1.535     +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.534
  retrieving revision 1.535
  diff -u -r1.534 -r1.535
  --- WHATSNEW	30 Jan 2004 14:44:38 -0000	1.534
  +++ WHATSNEW	30 Jan 2004 15:37:08 -0000	1.535
  @@ -31,6 +31,9 @@
   * The gcj compiler adapter for <javac> failed if the destination
     directory didn't exist.  Bugzilla Report 25856.
   
  +* Ant now fails with a more useful message if a new process will be
  +  forked in a directory and that directory doesn't exist.
  +
   Other changes:
   --------------
   * Translate task logs a debug message specifying the number of files
  
  
  
  1.71      +12 -3     ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- Execute.java	25 Sep 2003 14:51:07 -0000	1.70
  +++ Execute.java	30 Jan 2004 15:37:08 -0000	1.71
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -476,6 +476,9 @@
               launcher = shellLauncher;
           }
   
  +        if (dir != null && !dir.exists()) {
  +            throw new BuildException(dir + " doesn't exists.");
  +        }
           return launcher.exec(project, command, env, dir);
       }
   
  @@ -487,6 +490,9 @@
        *            of the subprocess failed
        */
       public int execute() throws IOException {
  +        if (workingDirectory != null && !workingDirectory.exists()) {
  +            throw new BuildException(workingDirectory + " doesn't exists.");
  +        }
           final Process process = launch(project, getCommandline(),
                                          getEnvironment(), workingDirectory,
                                          useVMLauncher);
  @@ -536,6 +542,9 @@
        * @since ant 1.6
        */
       public void spawn() throws IOException {
  +        if (workingDirectory != null && !workingDirectory.exists()) {
  +            throw new BuildException(workingDirectory + " doesn't exists.");
  +        }
           final Process process = launch(project, getCommandline(),
                                          getEnvironment(), workingDirectory,
                                          useVMLauncher);
  @@ -625,7 +634,7 @@
           // so we only return the new values which then will be set in
           // the generated DCL script, inheriting the parent process environment
           if (Os.isFamily("openvms")) {
  -                return env;
  +            return env;
           }
   
           Vector osEnv = (Vector) getProcEnvironment().clone();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message