1 # 2 # Copyright (C) 2018 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the 'License'); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an 'AS IS' BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 from host_controller.command_processor import base_command_processor 18 19 20 class CommandExit(base_command_processor.BaseCommandProcessor): 21 """Command processor for exit command. 22 23 Attributes: 24 arg_parser: ConsoleArgumentParser object, argument parser. 25 console: cmd.Cmd console object. 26 command: string, command name which this processor will handle. 27 command_detail: string, detailed explanation for the command. 28 """ 29 30 command = "exit" 31 command_detail = "" 32 33 # @Override 34 def Run(self, arg_line): 35 """Terminates the console. 36 37 Returns: 38 True, which stops the cmdloop. 39 """ 40 self.console.StopJobThreadAndProcessPool() 41 return True 42 43 def Help(self): 44 """Prints help message for exit command.""" 45 self._Print("Terminate the console.")