discover/grub2: Allow empty statements
[petitboot] / ui / ncurses / nc-cui.c
index 4baaec17d52ca4c9e242b45669c7d5b01bdce776..4f7b121b21ec760be378de3b4ccf78cf94ec11e6 100644 (file)
@@ -31,6 +31,7 @@
 #include "pb-protocol/pb-protocol.h"
 #include "talloc/talloc.h"
 #include "waiter/waiter.h"
+#include "process/process.h"
 #include "ui/common/discover-client.h"
 #include "nc-cui.h"
 
@@ -80,13 +81,13 @@ int cui_run_cmd(struct pmenu_item *item)
 {
        int result;
        struct cui *cui = cui_from_item(item);
-       const char *const *cmd_argv = item->data;
+       const char **cmd_argv = item->data;
 
        nc_scr_status_printf(cui->current, "Running %s...", cmd_argv[0]);
 
        def_prog_mode();
 
-       result = pb_run_cmd(cmd_argv, 1, 0);
+       result = process_run_simple_argv(item, cmd_argv);
 
        reset_prog_mode();
        redrawwin(cui->current->main_ncw);
@@ -507,6 +508,8 @@ struct cui *cui_init(void* platform_info,
        cui->platform_info = platform_info;
        cui->waitset = waitset_create(cui);
 
+       process_init(cui, cui->waitset, false);
+
        setlocale(LC_ALL, "");
 
        /* Loop here for scripts that just started the server. */
@@ -526,7 +529,7 @@ retry_start:
 
                start_deamon = 0;
 
-               result = pb_start_daemon();
+               result = pb_start_daemon(cui);
 
                if (!result)
                        goto retry_start;
@@ -594,7 +597,7 @@ int cui_run(struct cui *cui, struct pmenu *main, unsigned int default_item)
        while (1) {
                int result = waiter_poll(cui->waitset);
 
-               if (result < 0 && errno != EINTR) {
+               if (result < 0) {
                        pb_log("%s: poll: %s\n", __func__, strerror(errno));
                        break;
                }