diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2019-07-15 18:46:59 -0700 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2019-08-10 16:50:18 -0700 |
commit | 3c83737fa488281f20030b5b36d7e1d4ba4313c9 (patch) | |
tree | 058ab8e18ff6bacdcf4a2551bf8845b447bab88a /hardinfo | |
parent | 0133e9fba615d8b5b1c67976a1da702977dd74a3 (diff) |
Always pulse status bar while spawning processes synchronously
Diffstat (limited to 'hardinfo')
-rw-r--r-- | hardinfo/dmi_util.c | 4 | ||||
-rw-r--r-- | hardinfo/pci_util.c | 10 | ||||
-rw-r--r-- | hardinfo/usb_util.c | 4 | ||||
-rw-r--r-- | hardinfo/util.c | 11 | ||||
-rw-r--r-- | hardinfo/x_util.c | 6 |
5 files changed, 21 insertions, 14 deletions
diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c index 5f9f6f9a..91be8508 100644 --- a/hardinfo/dmi_util.c +++ b/hardinfo/dmi_util.c @@ -202,7 +202,7 @@ char *dmi_get_str_abs(const char *id_str) { /* try dmidecode, but may require root */ snprintf(full_path, PATH_MAX, "dmidecode -s %s", id_str); - spawned = g_spawn_command_line_sync(full_path, + spawned = hardinfo_spawn_command_line_sync(full_path, &out, &err, &i, NULL); if (spawned) { if (i == 0) @@ -303,7 +303,7 @@ char *dmidecode_read(const dmi_type *type) { snprintf(full_path, PATH_MAX, "dmidecode"); } - spawned = g_spawn_command_line_sync(full_path, + spawned = hardinfo_spawn_command_line_sync(full_path, &out, &err, &i, NULL); if (spawned) { if (i == 0) diff --git a/hardinfo/pci_util.c b/hardinfo/pci_util.c index ec80662b..2aa2ece3 100644 --- a/hardinfo/pci_util.c +++ b/hardinfo/pci_util.c @@ -99,9 +99,7 @@ static gboolean pci_fill_details(pcid *s) { gchar *pci_loc = pci_address_str(s->domain, s->bus, s->device, s->function); gchar *lspci_cmd = g_strdup_printf("lspci -D -s %s -vvv", pci_loc); - shell_status_pulse(); - - spawned = g_spawn_command_line_sync(lspci_cmd, + spawned = hardinfo_spawn_command_line_sync(lspci_cmd, &out, &err, NULL, NULL); g_free(lspci_cmd); g_free(pci_loc); @@ -213,9 +211,7 @@ static gboolean pci_get_device_lspci(uint32_t dom, uint32_t bus, uint32_t dev, u s->device = dev; s->function = func; - shell_status_pulse(); - - spawned = g_spawn_command_line_sync(lspci_cmd, + spawned = hardinfo_spawn_command_line_sync(lspci_cmd, &out, &err, NULL, NULL); g_free(lspci_cmd); if (spawned) { @@ -274,7 +270,7 @@ static pcid *pci_get_device_list_lspci(uint32_t class_min, uint32_t class_max) { if (class_max == 0) class_max = 0xffff; - spawned = g_spawn_command_line_sync("lspci -D -mn", + spawned = hardinfo_spawn_command_line_sync("lspci -D -mn", &out, &err, NULL, NULL); if (spawned) { p = out; diff --git a/hardinfo/usb_util.c b/hardinfo/usb_util.c index a758026f..f883657c 100644 --- a/hardinfo/usb_util.c +++ b/hardinfo/usb_util.c @@ -173,7 +173,7 @@ static gboolean usb_get_device_lsusb(int bus, int dev, usbd *s) { s->bus = bus; s->dev = dev; - spawned = g_spawn_command_line_sync(lsusb_cmd, + spawned = hardinfo_spawn_command_line_sync(lsusb_cmd, &out, &err, NULL, NULL); g_free(lsusb_cmd); if (spawned) { @@ -447,7 +447,7 @@ static usbd *usb_get_device_list_lsusb() { usbd *head = NULL, *nd; int bus, dev, vend, prod, ec; - spawned = g_spawn_command_line_sync("lsusb", + spawned = hardinfo_spawn_command_line_sync("lsusb", &out, &err, NULL, NULL); if (spawned) { p = out; diff --git a/hardinfo/util.c b/hardinfo/util.c index 1b92457c..e690ff20 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -1386,3 +1386,14 @@ gchar *hardinfo_clean_value(const gchar *v, int replacing) { g_free((gpointer)v); return clean; } + +gboolean hardinfo_spawn_command_line_sync(const gchar *command_line, + gchar **standard_output, + gchar **standard_error, + gint *exit_status, + GError **error) +{ + shell_status_pulse(); + return g_spawn_command_line_sync(command_line, standard_output, + standard_error, exit_status, error); +} diff --git a/hardinfo/x_util.c b/hardinfo/x_util.c index c052f00a..52888a8c 100644 --- a/hardinfo/x_util.c +++ b/hardinfo/x_util.c @@ -60,7 +60,7 @@ gboolean fill_glx_info(glx_info *glx) { #define GLX_MATCH_LINE(prefix_str, struct_member) \ if (l = simple_line_value(p, prefix_str)) { glx->struct_member = g_strdup(l); goto glx_next_line; } - spawned = g_spawn_command_line_sync(glx_cmd, + spawned = hardinfo_spawn_command_line_sync(glx_cmd, &out, &err, NULL, NULL); g_free(glx_cmd); if (spawned) { @@ -124,7 +124,7 @@ gboolean fill_xinfo(xinfo *xi) { #define XI_MATCH_LINE(prefix_str, struct_member) \ if (l = simple_line_value(p, prefix_str)) { xi->struct_member = g_strdup(l); goto xi_next_line; } - spawned = g_spawn_command_line_sync(xi_cmd, + spawned = hardinfo_spawn_command_line_sync(xi_cmd, &out, &err, NULL, NULL); g_free(xi_cmd); if (spawned) { @@ -166,7 +166,7 @@ gboolean fill_xrr_info(xrr_info *xrr) { memset(status, 0, 128); memset(alist, 0, 128); - spawned = g_spawn_command_line_sync(xrr_cmd, + spawned = hardinfo_spawn_command_line_sync(xrr_cmd, &out, &err, NULL, NULL); g_free(xrr_cmd); if (spawned) { |