Package org.jnode.shell

Examples of org.jnode.shell.CommandShell$HistoryInputStream


    private static TextConsole createConsoleWithShell(final ConsoleManager conMgr, PrintWriter out)
        throws ShellException {
        final TextConsole console = (TextConsole) conMgr.createConsole(null,
                ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE);
        CommandShell commandShell = new CommandShell(console);
        new Thread(commandShell, "command-shell").start();

        out.println("New console created with name: " + console.getConsoleName());

        // FIXME we shouldn't be setting the invoker (and interpreter) via the System Properties
View Full Code Here


        this.harness = harness;
        this.usingEmu = TestEmu.initEmu(harness.getRoot());
    }

    public CommandShell getShell() throws ShellException {
        CommandShell shell = new TestCommandShell(System.in, System.out, System.err);
        shell.configureShell();
        return shell;
    }
View Full Code Here

    private void run() throws Exception {
        TextScreenConsoleManager cm = new SwingTextScreenConsoleManager();
        TextScreenConsole console = cm.createConsole(
                "Console 1",
                (ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE));
        new Thread(new CommandShell(console, true)).start();
    }
View Full Code Here

        for (String arg : Args.getValues()) {
            sb.append(' ');
            sb.append(arg);
        }
       
        CommandShell shell = null;
        int ret = 1;
        try {
            shell = (CommandShell) ShellUtils.getShellManager().getCurrentShell();
            long start = System.currentTimeMillis();
            ret = shell.runCommand(sb.toString());
            long end = System.currentTimeMillis();
            out.format(fmt_diff, getRuntime((int) (end - start)));
        } catch (ShellException ex) {
            throw ex;
        } finally {
View Full Code Here

        } else if (commandLine.getCommandName() != null) {
            alias = commandLine.getCommandName();
        } else {
            alias = "help";
        }
        CommandShell shell = null;
        try {
            shell = (CommandShell) ShellUtils.getShellManager().getCurrentShell();
            CommandInfo cmdInfo =  shell.getCommandInfo(alias);
            Help cmdHelp = HelpFactory.getHelpFactory().getHelp(alias, cmdInfo);
            if (cmdHelp == null) {
                err.format(err_no_help, alias);
                exit(1);
            }
            cmdHelp.help(out);
            otherAliases(shell.getAliasManager(), alias, cmdInfo.getCommandClass().getName(), out);
        } catch (HelpException ex) {
            err.format(err_help_ex, alias, ex.getLocalizedMessage());
            throw ex;
        } catch (ShellException ex) {
            err.println(ex.getMessage());
View Full Code Here

                        ConsoleManager.CreateOptions.SCROLLABLE);

            mgr.registerConsole(first);
            mgr.focus(first);

            new CommandShell(first).run();
            Thread.sleep(60 * 1000);

        } catch (Throwable ex) {
            log.error("Error in FBConsole", ex);
        } finally {
View Full Code Here

        }

        public void invoke(String command) {
            if (shell != null) {
                if (shell instanceof CommandShell) {
                    CommandShell cs = (CommandShell) shell;
                    try {
                        cs.runCommand(command);
                    } catch (ShellException ex) {
                        System.err.println("Command invocation failed: " + ex.getMessage());
                    }
                } else {
                    System.err.println("Shell wasn't a CommandShell: " + shell.getClass());
View Full Code Here

    }

    @Override
    public int run() throws Exception {
        StringBuffer sb = new StringBuffer();
        CommandShell shell = getShell();
        sb.append(shell.escapeWord(spec.getCommand()));
        for (String arg : spec.getArgs()) {
            sb.append(" ").append(shell.escapeWord(arg));
        }
        int rc;
        try {
            rc = shell.runCommand(sb.toString());
        } catch (Throwable ex) {
            Class<? extends Throwable> exception = spec.getException();
            if (exception != null && exception.isInstance(ex)) {
                rc = 0;
            } else if (ex instanceof Error) {
View Full Code Here

       
        TextConsole console = cm.createConsole(
            null,
            (ConsoleManager.CreateOptions.TEXT |
                ConsoleManager.CreateOptions.SCROLLABLE));
        new Thread(new CommandShell(console), "SwingConsoleCommandShell").start();

        synchronized (SwingConsole.class) {
            frame = cm.getFrame();
        }
View Full Code Here

TOP

Related Classes of org.jnode.shell.CommandShell$HistoryInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.