mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gsubprocess: fix communicate() with empty buffers
On the splice for stdout or stderr completing, GSubprocess calls _slice_finish() to collect the result. We assume that a zero return value here means failure, but in fact this function returns a gssize -- the number of bytes transferred, or -1 for an error. This causes GSubprocess to mistakenly think that it has an error when it actually just has an empty buffer (as would be the case when collecting stderr from a successful command). Check for -1 instead of FALSE to detect the error. https://bugzilla.gnome.org/show_bug.cgi?id=724916
This commit is contained in:
parent
de142c0c5a
commit
9f71965bec
@ -1420,7 +1420,7 @@ g_subprocess_communicate_made_progress (GObject *source_object,
|
||||
source == state->stdout_buf ||
|
||||
source == state->stderr_buf)
|
||||
{
|
||||
if (!g_output_stream_splice_finish ((GOutputStream*)source, result, &error))
|
||||
if (g_output_stream_splice_finish ((GOutputStream*) source, result, &error) == -1)
|
||||
goto out;
|
||||
|
||||
if (source == state->stdout_buf ||
|
||||
|
Loading…
Reference in New Issue
Block a user