return -1, in which case we never need to suppress output.
noticed by Mark Patruck
# ex:ts=8 sw=4:
-# $OpenBSD: State.pm,v 1.67 2021/01/30 11:19:01 espie Exp $
+# $OpenBSD: State.pm,v 1.68 2021/01/31 15:22:55 espie Exp $
#
# Copyright (c) 2007-2014 Marc Espie <espie@openbsd.org>
#
OpenBSD::Auto::cache(can_output,
sub {
require POSIX;
+
# XXX uses POSIX semantics so fd, we can hardcode stdout ;)
- return getpgrp() == POSIX::tcgetpgrp(1);
+ my $s = POSIX::tcgetpgrp(1);
+ # note that STDOUT may be redirected (tcgetpgrp() will fail)
+ return $s == -1 || getpgrp() == $s;
});
sub sync_display