commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patri...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher LaunchCommand.java LaunchTask.java
Date Sat, 20 Jul 2002 15:21:30 GMT
patrickl    2002/07/20 08:21:30

  Modified:    daemon/src/bin launcher.xml
               daemon/src/java/org/apache/commons/launcher
                        LaunchCommand.java LaunchTask.java
  Log:
  Add "usesystemin" property.
  
  Revision  Changes    Path
  1.4       +2 -0      jakarta-commons-sandbox/daemon/src/bin/launcher.xml
  
  Index: launcher.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/bin/launcher.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- launcher.xml	16 Jul 2002 06:42:28 -0000	1.3
  +++ launcher.xml	20 Jul 2002 15:21:30 -0000	1.4
  @@ -60,6 +60,7 @@
   
       <!-- Set the defaults launch settings -->
       <property name="wait" value="false"/>
  +    <property name="read.system.in" value="false"/>
       <property name="require.tools" value="true"/>
       <property name="redirect.output" value="true"/>
       <property name="output" location="${app.home}/logs/ant.log"/>
  @@ -73,6 +74,7 @@
        -->
       <launch classname="org.apache.tools.ant.Main"
         waitforchild="${wait}"
  +      usesystemin="${read.system.in}"
         requiretools="${require.tools}"
         redirectoutput="${redirect.output}"
         output="${output}"
  
  
  
  1.3       +31 -0     jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/LaunchCommand.java
  
  Index: LaunchCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/LaunchCommand.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LaunchCommand.java	19 Jul 2002 18:57:44 -0000	1.2
  +++ LaunchCommand.java	20 Jul 2002 15:21:30 -0000	1.3
  @@ -133,6 +133,11 @@
       private HashMap sysProperties = null;
   
       /**
  +     * Cached useSystemIn flag.
  +     */
  +    private boolean useSystemIn = true;
  +
  +    /**
        * Cached waitForChild flag.
        */
       private boolean waitForChild = true;
  @@ -277,6 +282,17 @@
       }
   
       /**
  +     * Get the useSystemIn flag.
  +     *
  +     * @return the useSystemIn flag
  +     */
  +    public boolean getUsesystemin() {
  +
  +        return useSystemIn;
  +
  +    }
  +
  +    /**
        * Get the waitForChild flag.
        *
        * @return the waitForChild flag
  @@ -284,6 +300,21 @@
       public boolean getWaitforchild() {
   
           return waitForChild;
  +
  +    }
  +
  +    /**
  +     * Set the useSystemIn flag. Setting this flag to false will cause this
  +     * task to not read System.in. This will cause the child JVM to never
  +     * receive any bytes when it reads System.in. Setting this flag to false
  +     * is useful in some Unix environments where processes cannot be put in
  +     * the background when they read System.in.
  +     *
  +     * @param useSystemIn the useSystemIn flag
  +     */
  +    public void setUsesystemin(boolean useSystemIn) {
  +
  +        this.useSystemIn = useSystemIn;
   
       }
   
  
  
  
  1.15      +31 -5     jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/LaunchTask.java
  
  Index: LaunchTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/LaunchTask.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LaunchTask.java	19 Jul 2002 20:10:45 -0000	1.14
  +++ LaunchTask.java	20 Jul 2002 15:21:30 -0000	1.15
  @@ -211,6 +211,11 @@
       private boolean useArgs = true;
   
       /**
  +     * Cached useSystemIn flag.
  +     */
  +    private boolean useSystemIn = true;
  +
  +    /**
        * Cached waitForChild flag.
        */
       private boolean waitForChild = true;
  @@ -420,6 +425,7 @@
               boolean filteredDisposeMinimizedWindow = disposeMinimizedWindow;
               String filteredMinimizedWindowTitle = minimizedWindowTitle;
               File filteredMinimizedWindowIcon = minimizedWindowIcon;
  +            boolean filteredUseSystemIn = useSystemIn;
               boolean filteredWaitForChild = waitForChild;
   
               // If there is a filter in the filterclassname attribute, let it
  @@ -453,7 +459,8 @@
                            command.setDisposeminimizedwindow(filteredDisposeMinimizedWindow);
                            command.setMinimizedwindowtitle(filteredMinimizedWindowTitle);
                            command.setMinimizedwindowicon(filteredMinimizedWindowIcon);
  -                         command.setWaitforchild(waitForChild);
  +                         command.setWaitforchild(filteredUseSystemIn);
  +                         command.setWaitforchild(filteredWaitForChild);
                            filter.filter(command);
                            jvmArgs = command.getJvmargs();
                            sysProps = command.getSysproperties();
  @@ -467,6 +474,7 @@
                            filteredDisposeMinimizedWindow = command.getDisposeminimizedwindow();
                            filteredMinimizedWindowTitle = command.getMinimizedwindowtitle();
                            filteredMinimizedWindowIcon = command.getMinimizedwindowicon();
  +                         filteredUseSystemIn = command.getWaitforchild();
                            filteredWaitForChild = command.getWaitforchild();
                            // Check changes
                            if (filteredMainClassName == null)
  @@ -603,14 +611,17 @@
                       new StreamConnector(proc.getInputStream(), System.out);
                   StreamConnector stderr =
                       new StreamConnector(proc.getErrorStream(), System.err);
  -                StreamConnector stdin =
  -                    new StreamConnector(System.in, proc.getOutputStream());
                   stdout.start();
                   stderr.start();
  -                stdin.start();
  +                if (filteredUseSystemIn) {
  +                    StreamConnector stdin =
  +                        new StreamConnector(System.in, proc.getOutputStream());
  +                    stdin.start();
  +                }
  +                proc.waitFor();
  +                // Let threads flush any unflushed output
                   stdout.join();
                   stderr.join();
  -                proc.waitFor();
               }
               // Need to check if the launching process has stopped because
               // processes don't throw exceptions when they are terminated
  @@ -647,6 +658,21 @@
       public void setUseargs(boolean useArgs) {
   
           this.useArgs = useArgs;
  +
  +    }
  +
  +    /**
  +     * Set the useSystemIn flag. Setting this flag to false will cause this 
  +     * task to not read System.in. This will cause the child JVM to never
  +     * receive any bytes when it reads System.in. Setting this flag to false
  +     * is useful in some Unix environments where processes cannot be put in
  +     * the background when they read System.in.
  +     *
  +     * @param useSystemIn the useSystemIn flag
  +     */
  +    public void setUsesystemin(boolean useSystemIn) {
  +
  +        this.useSystemIn = useSystemIn;
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message