Skip to content

Commit

Permalink
do report an exception when running a CLI; test it
Browse files Browse the repository at this point in the history
WIP, found in bsc#935937
  • Loading branch information
mvidner committed Jun 30, 2015
1 parent dbceace commit 49184d2
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions library/commandline/src/modules/CommandLine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def main
"help" => _(
"Abort interactive mode without saving the changes"
)
},
"please-crash" => {
"help" => "Simulates an internal error"
}
},
"options" => {
Expand Down Expand Up @@ -915,6 +918,10 @@ def ProcessSystemCommands(command)
return true
end

if Ops.get_string(command, "command", "") == "please-crash"
raise "Crashing as requested"
end

if Ops.get_string(command, "command", "") == "help"
# don't print header when custom help is defined
PrintHead() if !Builtins.haskey(@modulecommands, "customhelp")
Expand Down Expand Up @@ -1599,9 +1606,9 @@ def Run(commandline)
# disable Reports, we handle them on our own
Report.Import(

"messages" => { "show" => false },
"warnings" => { "show" => false },
"errors" => { "show" => false }
"messages" => { "show" => false },
"warnings" => { "show" => false },
"errors" => { "show" => false }

)

Expand Down Expand Up @@ -1694,6 +1701,13 @@ def Run(commandline)
Builtins.y2milestone("----------------------------------------")

ret
ensure
Builtins.y2milestone("Re-enabling reports")
Report.Import(
"messages" => { "show" => true },
"warnings" => { "show" => true },
"errors" => { "show" => true }
)
end

# Ask user, commandline equivalent of Popup::YesNo()
Expand Down

0 comments on commit 49184d2

Please sign in to comment.