1155 * <p> |
1155 * <p> |
1156 * If starting any of the processes throws an Exception, all processes |
1156 * If starting any of the processes throws an Exception, all processes |
1157 * are forcibly destroyed. |
1157 * are forcibly destroyed. |
1158 * <p> |
1158 * <p> |
1159 * The {@code startPipeline} method performs the same checks on |
1159 * The {@code startPipeline} method performs the same checks on |
1160 * each ProcessBuilder as does the {@link #start} method. The new process |
1160 * each ProcessBuilder as does the {@link #start} method. Each new process |
1161 * will invoke the command and arguments given by {@link #command()}, |
1161 * invokes the command and arguments given by the respective process builder's |
1162 * in a working directory as given by {@link #directory()}, |
1162 * {@link #command()}, in a working directory as given by its {@link #directory()}, |
1163 * with a process environment as given by {@link #environment()}. |
1163 * with a process environment as given by its {@link #environment()}. |
1164 * <p> |
1164 * <p> |
1165 * This method checks that the command is a valid operating |
1165 * Each process builder's command is checked to be a valid operating |
1166 * system command. Which commands are valid is system-dependent, |
1166 * system command. Which commands are valid is system-dependent, |
1167 * but at the very least the command must be a non-empty list of |
1167 * but at the very least the command must be a non-empty list of |
1168 * non-null strings. |
1168 * non-null strings. |
1169 * <p> |
1169 * <p> |
1170 * A minimal set of system dependent environment variables may |
1170 * A minimal set of system dependent environment variables may |
1172 * As a result, the subprocess may inherit additional environment variable |
1172 * As a result, the subprocess may inherit additional environment variable |
1173 * settings beyond those in the process builder's {@link #environment()}. |
1173 * settings beyond those in the process builder's {@link #environment()}. |
1174 * <p> |
1174 * <p> |
1175 * If there is a security manager, its |
1175 * If there is a security manager, its |
1176 * {@link SecurityManager#checkExec checkExec} |
1176 * {@link SecurityManager#checkExec checkExec} |
1177 * method is called with the first component of this object's |
1177 * method is called with the first component of each process builder's |
1178 * {@code command} array as its argument. This may result in |
1178 * {@code command} array as its argument. This may result in |
1179 * a {@link SecurityException} being thrown. |
1179 * a {@link SecurityException} being thrown. |
1180 * <p> |
1180 * <p> |
1181 * Starting an operating system process is highly system-dependent. |
1181 * Starting an operating system process is highly system-dependent. |
1182 * Among the many things that can go wrong are: |
1182 * Among the many things that can go wrong are: |
1192 * subclass of {@link IOException}. |
1192 * subclass of {@link IOException}. |
1193 * <p> |
1193 * <p> |
1194 * If the operating system does not support the creation of |
1194 * If the operating system does not support the creation of |
1195 * processes, an {@link UnsupportedOperationException} will be thrown. |
1195 * processes, an {@link UnsupportedOperationException} will be thrown. |
1196 * <p> |
1196 * <p> |
1197 * Subsequent modifications to this process builder will not |
1197 * Subsequent modifications to any of the specified builders |
1198 * affect the returned {@link Process}. |
1198 * will not affect the returned {@link Process}. |
1199 * @apiNote |
1199 * @apiNote |
1200 * For example to count the unique imports for all the files in a file hierarchy |
1200 * For example to count the unique imports for all the files in a file hierarchy |
1201 * on a Unix compatible platform: |
1201 * on a Unix compatible platform: |
1202 * <pre>{@code |
1202 * <pre>{@code |
1203 * String directory = "/home/duke/src"; |
1203 * String directory = "/home/duke/src"; |