Skip to content

Commit

Permalink
Merge pull request #160 from rundeck/issue/156
Browse files Browse the repository at this point in the history
Fix #156 npe if no stdin for project delete without --confirm
  • Loading branch information
gschueler authored Apr 18, 2018
2 parents e3009db + cb33bfc commit e82c060
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/rundeck/client/tool/commands/Projects.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ public boolean delete(ProjectDelete options, CommandOutput output) throws IOExce
String project = projectOrEnv(options);
if (!options.isConfirm()) {
//request confirmation
String s = System.console().readLine("Really delete project %s? (y/N) ", project);
Console console = System.console();
String s = "n";
if (null != console) {
s = console.readLine("Really delete project %s? (y/N) ", project);
} else {
output.warning("No console input available, and --confirm/-y was not set.");
}

if (!"y".equals(s)) {
output.warning(String.format("Not deleting project %s.", project));
Expand Down

0 comments on commit e82c060

Please sign in to comment.