Skip to content

Commit 794426d

Browse files
committed
dl-worker: prevent spinning if stdin hangs up
1 parent 443d748 commit 794426d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/dl-worker.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ BZ_DEFINE_DATA (
3535
BZ_RELEASE_DATA (dest, g_free));
3636

3737
static DexFuture *
38-
read_stdin (gpointer user_data);
38+
read_stdin (GMainLoop *loop);
3939

4040
static DexFuture *
4141
download_fiber (DownloadData *data);
@@ -57,14 +57,14 @@ main (int argc,
5757
dex_thread_pool_scheduler_get_default (),
5858
bz_get_dex_stack_size (),
5959
(DexFiberFunc) read_stdin,
60-
NULL, NULL));
60+
main_loop, NULL));
6161
g_main_loop_run (main_loop);
6262

6363
return EXIT_SUCCESS;
6464
}
6565

6666
static DexFuture *
67-
read_stdin (gpointer user_data)
67+
read_stdin (GMainLoop *loop)
6868
{
6969
g_autoptr (GIOChannel) stdin_channel = NULL;
7070

@@ -83,8 +83,9 @@ read_stdin (gpointer user_data)
8383
stdin_channel, &string, NULL, NULL, &local_error);
8484
if (local_error != NULL)
8585
{
86-
g_critical ("Failure reading stdin channel: %s", local_error->message);
87-
continue;
86+
g_critical ("FATAL: Failure reading stdin channel: %s", local_error->message);
87+
g_main_loop_quit (loop);
88+
return NULL;
8889
}
8990
if (string == NULL)
9091
continue;

0 commit comments

Comments
 (0)