gsubprocess: Fix error detection logic in tests