Enable curses after the mining threads are set up so that failure messages won't be lost in the curses interface.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/main.c b/main.c
index 2aa7422..8111ec5 100644
--- a/main.c
+++ b/main.c
@@ -4481,9 +4481,28 @@ out:
}
#endif // defined(unix)
+static void enable_curses(void) {
+ int x,y;
+
+ if (curses_active)
+ return;
+
+ mainwin = initscr();
+ getmaxyx(mainwin, y, x);
+ statuswin = newwin(logstart, x, 0, 0);
+ leaveok(statuswin, true);
+ logwin = newwin(y - logcursor, 0, logcursor, 0);
+ idlok(logwin, true);
+ scrollok(logwin, true);
+ leaveok(logwin, true);
+ cbreak();
+ noecho();
+ test_and_set(&curses_active);
+}
+
int main (int argc, char *argv[])
{
- unsigned int i, x, y, pools_active = 0;
+ unsigned int i, pools_active = 0;
struct block *block, *tmpblock;
struct work *work, *tmpwork;
struct sigaction handler;
@@ -4672,28 +4691,14 @@ int main (int argc, char *argv[])
logstart = cpucursor + (opt_n_threads ? num_processors : 0) + 1;
logcursor = logstart + 1;
- /* Set up the ncurses interface */
- if (!opt_realquiet && use_curses) {
- mainwin = initscr();
- getmaxyx(mainwin, y, x);
- statuswin = newwin(logstart, x, 0, 0);
- leaveok(statuswin, true);
- logwin = newwin(y - logcursor, 0, logcursor, 0);
- idlok(logwin, true);
- scrollok(logwin, true);
- leaveok(logwin, true);
- cbreak();
- noecho();
- test_and_set(&curses_active);
- }
+ if (opt_realquiet)
+ use_curses = false;
if (!total_pools) {
- if (curses_active) {
- applog(LOG_WARNING, "Need to specify at least one pool server.");
- if (!input_pool(false))
- quit(1, "Pool setup failed");
- } else
- quit(1, "No server specified");
+ enable_curses();
+ applog(LOG_WARNING, "Need to specify at least one pool server.");
+ if (!input_pool(false))
+ quit(1, "Pool setup failed");
}
for (i = 0; i < total_pools; i++) {
@@ -4910,6 +4915,9 @@ int main (int argc, char *argv[])
opt_n_threads,
algo_names[opt_algo]);
+ if (use_curses)
+ enable_curses();
+
watchdog_thr_id = mining_threads + 2;
thr = &thr_info[watchdog_thr_id];
/* start wakeup thread */