Fix t/pt-agent/make_new_crontab.t.

This commit is contained in:
Daniel Nichter
2013-01-30 16:44:22 -07:00
parent 7331a7f857
commit f7813c9495

View File

@@ -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);