Uploaded image for project: 'Aesh'
  1. Aesh
  2. AESH-408

Add capability to set a custom AeshConsoleCallback implementation

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Alpha1
    • 0.66.10
    • main
    • None

      My use case is that I'm only using Aesh for injecting command line arguments, and structuring command classes. I need to control all error output to stdout / stderr, and I need to exit java process with error code when an error occurs. In essence - I only do one REPL cycle, and exit.

      Currently the only way to set a custom AeshConsoleCallback is to get a private 'console' field on AeshConsoleImpl, and calling Console.setConsoleCallback() on it. That requires reflection hacks.

      Field field = AeshConsoleImpl.class.getDeclaredField("console");
      field.setAccessible(true);
      Console internalConsole = (Console) field.get(console);
      internalConsole.setConsoleCallback(new MyAeshConsoleCallbackImpl(console));
      

              spederse@redhat.com Stale Pedersen
              marko.strukelj@gmail.com Marko Strukelj
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: