From f7813c9495bfd861fe3f404e65d09f1167a7fb79 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Wed, 30 Jan 2013 16:44:22 -0700 Subject: [PATCH] Fix t/pt-agent/make_new_crontab.t. --- t/pt-agent/make_new_crontab.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/pt-agent/make_new_crontab.t b/t/pt-agent/make_new_crontab.t index 40bd8b03..90129fcf 100644 --- a/t/pt-agent/make_new_crontab.t +++ b/t/pt-agent/make_new_crontab.t @@ -99,8 +99,12 @@ my $crontab = `crontab -l 2>/dev/null`; SKIP: { skip 'Crontab is not empty', 3 if $crontab; + # Crontab lines must end with a newline, else an error + # like this happens: + # "/tmp/new_crontab_file":1: premature EOF + # errors in crontab file, can't install. my ($fh, $file) = tempfile(); - print {$fh} "* 0 * * * date > /dev/null"; + print {$fh} "* 0 * * * date > /dev/null\n"; close $fh or warn "Cannot close $file: $OS_ERROR"; my $output = `crontab $file 2>&1`; @@ -108,7 +112,7 @@ SKIP: { is( $crontab, - "* 0 * * * date > /dev/null", + "* 0 * * * date > /dev/null\n", "Set other crontab line" ) or diag($output);