#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw{:all};
my $command = './pm_test_no_echo_nl.sh';
my $timeout = 3;
my $pid = open my $pipe_from, '-|', $command;
local $SIG{ALRM} = sub { kill HUP => $pid; die "No data\n" };
alarm $timeout;
while (<$pipe_from>) {
alarm 0;
print;
alarm $timeout;
}
####
#!/bin/sh
echo With newline
echo With newline
echo "NO newline\c"
sleep 5
echo With newline
####
With newline
With newline
NO newlineWith newline
####
With newline
With newline
No data