| 246 | |
| 247 | |
| 248 | public Command add(Command command) throws IOException { |
| 249 | if (this.close) { |
| 250 | throw new IllegalStateException( |
| 251 | "Unable to add commands to a closed shell"); |
| 252 | } |
| 253 | |
| 254 | if(command.used) { |
| 255 | //The command has been used, don't re-use... |
| 256 | throw new IllegalStateException( |
| 257 | "This command has already been executed. (Don't re-use command instances.)"); |
| 258 | } |
| 259 | |
| 260 | while (this.isCleaning) { |
| 261 | //Don't add commands while cleaning |
| 262 | ; |
| 263 | } |
| 264 | |
| 265 | this.commands.add(command); |
| 266 | |
| 267 | this.notifyThreads(); |
| 268 | |
| 269 | return command; |
| 270 | } |
| 271 | |
| 272 | public final void useCWD(Context context) throws IOException, TimeoutException, RootDeniedException { |
| 273 | add( |