in reply to Re: Cannot use IO::Pty::Easy from within xinetd
in thread Cannot use IO::Pty::Easy from within xinetd
If you run that with xinetd you will find out that subprocess cannot be launched.#!/usr/bin/perl use strict; use warnings; use IO::Pty::Easy; # Get stdin when this char is found (Telnet). $/ = "\n"; # Autoflush, write without buffering (Telnet). $| = 1; # Main loop. undef $_; my $quit = 0; my $input; my $pty = IO::Pty::Easy->new(); do { $input = <STDIN>; # Remove trailing new line character. $input =~ s/\r//g; $input =~ s/\n//g; eval { if ($input =~ /quit/) { $quit = 1; } elsif ($input =~ /run/) { my $st = $pty->spawn("/usr/bin/omshell"); die "Cannot run /usr/bin/omshell" unless ($st); } else { reply(help()); } }; reply($@) if ($@); print "> "; } while (!$quit); sub help { #--------------------------------------------------------------------- +---------| return qq{ quit run Launch app over IO::Pty::Easy. }; } # Reply to user. sub reply { print shift, "\n"; }
|
|---|