()
| 69 | new Runnable() { |
| 70 | |
| 71 | @Override |
| 72 | public void run() { |
| 73 | Control control; |
| 74 | try { |
| 75 | control = initControl(); |
| 76 | } catch (IllegalStateException e) { |
| 77 | System.err.println("Failed to start ZAP. " + e.getMessage()); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | warnAddOnsAndExtensionsNoLongerRunnable(); |
| 82 | |
| 83 | if (!handleCmdLineSessionArgsSynchronously(control)) { |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | HeadlessBootstrap.checkForUpdates(); |
| 88 | |
| 89 | try { |
| 90 | // Allow extensions to pick up command line args in daemon mode |
| 91 | control.getExtensionLoader().hookCommandLineListener(getArgs()); |
| 92 | recordStartStats(); |
| 93 | control.runCommandLine(); |
| 94 | } catch (ShutdownRequestedException e) { |
| 95 | control.shutdown(false); |
| 96 | LOGGER.info("{} terminated.", Constant.PROGRAM_TITLE); |
| 97 | return; |
| 98 | } catch (Exception e) { |
| 99 | LOGGER.error(e.getMessage(), e); |
| 100 | } |
| 101 | |
| 102 | // This is the only non-daemon thread, so should keep running |
| 103 | // CoreAPI.handleApiAction uses System.exit to shutdown |
| 104 | while (true) { |
| 105 | try { |
| 106 | Thread.sleep(100000); |
| 107 | |
| 108 | } catch (InterruptedException e) { |
| 109 | // Ignore |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | }); |
| 114 | |
| 115 | t.setName("ZAP-daemon"); |
nothing calls this directly
no test coverage detected