In the XS source code at https://metacpan.org/release/TODDR/IO-Tty-1.20/source/Tty.xs#L256, running the code it bothers you is controlled by the constant HAVE_GRANTPT which I believe is set during compiling Perl. So, it will try running it if your Perl installation found that you have it. The warning is about permissions. So perhaps you can investigate and solve it at the OS level.
Warnings can be controlled also at the block level. But you can not tell a module to stop warning unless that module has this line at its preamble: use warnings::register; in which case you use no warnings 'My::Module'; but that means you raise an issue with the author to include that line. Note that this method failed for me for some reason...
Your other option is to create a warn-handler and filter out (via regex) that particular warning:
# from https://www.reddit.com/r/perl/comments/1256khf/comment/je3wh0m/ +?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_c +ontent=share_button local $SIG{__WARN__} = sub { return if $_[0] =~ /IO::Pty blah blah/; print STDERR "$_\n"; };
In reply to Re: Solve IO::Pty warning issues from Net::OpenSSH
by bliako
in thread Solve IO::Pty warning issues from Net::OpenSSH
by dkhosla1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |