Search in sources :

Example 1 with TTYConsoleReader

use of com.orientechnologies.common.console.TTYConsoleReader in project orientdb by orientechnologies.

the class OConsoleDatabaseApp method main.

public static void main(final String[] args) {
    int result = 0;
    try {
        boolean tty = false;
        try {
            if (setTerminalToCBreak())
                tty = true;
            Runtime.getRuntime().addShutdownHook(new Thread() {

                @Override
                public void run() {
                    restoreTerminal();
                }
            });
        } catch (Exception ignored) {
        }
        new OSignalHandler().installDefaultSignals(new SignalHandler() {

            public void handle(Signal signal) {
                restoreTerminal();
            }
        });
        final OConsoleDatabaseApp console = new OConsoleDatabaseApp(args);
        if (tty)
            console.setReader(new TTYConsoleReader());
        result = console.run();
    } finally {
        restoreTerminal();
    }
    Orient.instance().shutdown();
    System.exit(result);
}
Also used : Signal(sun.misc.Signal) TTYConsoleReader(com.orientechnologies.common.console.TTYConsoleReader) OSignalHandler(com.orientechnologies.orient.core.OSignalHandler) SignalHandler(sun.misc.SignalHandler) OSystemException(com.orientechnologies.common.exception.OSystemException) OConfigurationException(com.orientechnologies.orient.core.exception.OConfigurationException) ORetryQueryException(com.orientechnologies.orient.core.exception.ORetryQueryException) OIOException(com.orientechnologies.common.io.OIOException) ODatabaseException(com.orientechnologies.orient.core.exception.ODatabaseException) OSignalHandler(com.orientechnologies.orient.core.OSignalHandler)

Example 2 with TTYConsoleReader

use of com.orientechnologies.common.console.TTYConsoleReader in project orientdb by orientechnologies.

the class OGremlinConsole method main.

public static void main(final String[] args) {
    int result;
    try {
        boolean tty = false;
        try {
            if (setTerminalToCBreak())
                tty = true;
        } catch (Exception e) {
        }
        final OConsoleDatabaseApp console = new OGremlinConsole(args);
        if (tty)
            console.setReader(new TTYConsoleReader());
        result = console.run();
    } finally {
        try {
            stty("echo");
        } catch (Exception e) {
        }
    }
    System.exit(result);
}
Also used : TTYConsoleReader(com.orientechnologies.common.console.TTYConsoleReader) OConsoleDatabaseApp(com.orientechnologies.orient.console.OConsoleDatabaseApp) OStorageException(com.orientechnologies.orient.core.exception.OStorageException) ODatabaseImportException(com.orientechnologies.orient.core.db.tool.ODatabaseImportException) IOException(java.io.IOException) OCommandExecutorNotFoundException(com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException)

Aggregations

TTYConsoleReader (com.orientechnologies.common.console.TTYConsoleReader)2 OSystemException (com.orientechnologies.common.exception.OSystemException)1 OIOException (com.orientechnologies.common.io.OIOException)1 OConsoleDatabaseApp (com.orientechnologies.orient.console.OConsoleDatabaseApp)1 OSignalHandler (com.orientechnologies.orient.core.OSignalHandler)1 OCommandExecutorNotFoundException (com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException)1 ODatabaseImportException (com.orientechnologies.orient.core.db.tool.ODatabaseImportException)1 OConfigurationException (com.orientechnologies.orient.core.exception.OConfigurationException)1 ODatabaseException (com.orientechnologies.orient.core.exception.ODatabaseException)1 ORetryQueryException (com.orientechnologies.orient.core.exception.ORetryQueryException)1 OStorageException (com.orientechnologies.orient.core.exception.OStorageException)1 IOException (java.io.IOException)1 Signal (sun.misc.Signal)1 SignalHandler (sun.misc.SignalHandler)1