Exit cmd cleanly.
764518
def postcmd(self, stop, line):
        '''  '''
        self.color_prompt()
        return Cmd.postcmd(self, stop, line)
1188898
def _do_exit(self, cmd, args):
        
        if cmd == 'end':
            if not args:
                return 'root'
            else:
                self.stderr.write(textwrap.dedent('''\
                        end: unrecognized arguments: {}
                        ''')).format(args)

        # Hereafter, cmd == 'exit'.
        if not args:
            return True
        if len(args) > 1:
            self.stderr.write(textwrap.dedent('''\
                    exit: too many arguments: {}
                    ''')).format(args)
        exit_directive = args[0]
        if exit_directive == 'root':
            return 'root'
        if exit_directive == 'all':
            return 'all'
        self.stderr.write(textwrap.dedent('''\
                exit: unrecognized arguments: {}
                ''')).format(args)
1306975
def command_stop(self):
        '''
        
        '''
        if self.pidfile:
            if not os.path.exists(self.pidfile):
                sys.exit("Pidfile {!r} doesn't exist".format(self.pidfile))
            with open(self.pidfile) as pidfile:
                pid = int(pidfile.read())
            for sig in [signal.SIGINT, signal.SIGTERM, signal.SIGKILL]:
                try:
                    if terminate(pid, sig, 3):
                        os.remove(self.pidfile)
                        # NOTE: we are not performing sys.exit here,
                        # otherwise restart command will not work
                        return
                except OSError as exc:
                    if exc.errno != errno.ESRCH:
                        raise
                    elif sig == signal.SIGINT:
                        sys.exit('Not running')
        sys.exit('No pidfile provided')
449540
def stop(ctx, rm=False):
    ''''''
    with ctx.cd(ROOT):
        compose(ctx, 'stop')
        if rm:
            compose(ctx, 'rm --force')
1043256
def quit(self):
        
        cmd = b"quit\r\n"
        self._misc_cmd([cmd], b'quit', True)
        self.close()
42304
def do_quit(self, _: argparse.Namespace) -> bool:
        """"""
        self._should_quit = True
        return self._STOP_AND_EXIT
1006359
def do_exit(self, line):
        """"""
        n_remaining_operations = len(self._command_processor.get_operation_queue())
        if n_remaining_operations:
            d1_cli.impl.util.print_warn(
                """There are {} unperformed operations in the write operation queue. These will
be lost if you exit.""".format(
                    n_remaining_operations
                )
            )
            if not d1_cli.impl.util.confirm("Exit?", default="yes"):
                return
        sys.exit()
1032913
def quit(self):
        
        self.script.LOG.warn("Abort due to user choice!")
        sys.exit(self.QUIT_RC)
308157
public void exit() {

        if (m_exitCalled) {
            return;
        }
        m_exitCalled = true;
        try {
            if (m_additionalShellCommands != null) {
                m_additionalShellCommands.shellExit();
            } else if (null != m_shellCommands) {
                m_shellCommands.shellExit();
            }
        } catch (Throwable t) {
            t.printStackTrace();
        }
        if (m_opencms != null) {
            // if called by an in line script we don't want to kill the whole instance
            try {
                m_opencms.shutDown();
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
    }
617020
def exit(self):
        """"""
        # First detach all servo's, otherwise it somehow doesn't want to close...
        if hasattr(self, 'digital'):
            for pin in self.digital:
                if pin.mode == SERVO:
                    pin.mode = OUTPUT
        if hasattr(self, 'sp'):
            self.sp.close()
604022
def remove(self, path):
        """"""
        p = self.cmd('shell', 'rm', path)
        stdout, stderr = p.communicate()
        if stdout or stderr:
            return False
        else:
            return True
116559
def run_and_exit(command_class):
    ''''''
    cmd = command_class(sys.argv[1:])
    if cmd.error:
        print('error: {0}'.format(cmd.error))
        sys.exit(1)
    else:
        sys.exit(cmd.run())
1294682
def cli(ctx, pattern):
    """"""
    matches = utils.grep_commands(pattern)
    if matches:
        selected = utils.select_command(matches)
        if selected >= 0:
            cmd, desc = matches[selected]
            command = "$ {} :: {}".format(cmd, desc)
            if click.confirm("Remove\n\t{}\n\n?".format(command), default=True):
                utils.remove_command(cmd)
                click.echo('Command successfully removed!')
    elif matches == []:
        click.echo('No saved commands matches the pattern {}'.format(pattern))
    else:
        click.echo("No commands to remove, Add one by 'keep new'. ")
291237
def do_quit(self, arg):
        
        if self.cmdprefix:
            raise CmdError("prefix not allowed")
        if arg:
            raise CmdError("too many arguments")
        if self.confirm_quit:
            count = self.debug.get_debugee_count()
            if count > 0:
                if count == 1:
                    msg = "There's a program still running."
                else:
                    msg = "There are %s programs still running." % count
                if not self.ask_user(msg):
                    return False
        self.debuggerExit = True
        return True
540085
def _exit(self):
        
        self._removeInputPrompt()
        print(self._color(self.COLOR_YELLOW, 'CLOSING TERMINAL...')) 
        self.stop()
182661
def _cleanup(path: str) -> None:
    """"""
    if os.path.isdir(path):
        shutil.rmtree(path)
612687
function executeCmd(cmd, debug, quitapp) {
    if (typeof cmd !== 'object') {
        throw new Error('Empty or invalid argument list!');
    }

    let finalcmd = cmd.join(' ');

    if (debug) {
        // debug mode, print to console
        console.log(`Debug shutdown command: ${finalcmd}`)
        if (quitapp) {
            console.log("Now exit app...");
            app.exit(0);
        }
    } else {
        cp.exec(finalcmd, (err, stdout, stderr) => {
            if (err) {
                console.error(err);
                return;
            }
            //console.log(stdout);
            if (quitapp) {
                app.exit(0);
            }
        });
    }
}