summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexmk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-05 00:04:26 +0000
committerKarl Berry <karl@freefriends.org>2011-02-05 00:04:26 +0000
commit9a354cbbcf35c3a26b5234bc9dc6bb3d44b24dd4 (patch)
tree0fdc224c85673c1c02c041260d45b757a1eb838b /Master/texmf-dist/scripts/latexmk
parent884a1d5cd40763780f0dba415b6c2d81aeeee04d (diff)
latexmk 4.22e (4feb11)
git-svn-id: svn://tug.org/texlive/trunk@21284 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexmk')
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl72
1 files changed, 25 insertions, 47 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index 88d6bdbec05..4f0c9b13228 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -107,8 +107,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.22d';
-$version_details = "$My_name, John Collins, 26 January 2011";
+$version_num = '4.22e';
+$version_details = "$My_name, John Collins, 3 February 2011";
use Config;
@@ -177,6 +177,7 @@ else {
##
## Modification log from 23 Jun 2010 onwards in detail
##
+## 3 Feb 2011, John Collins Correct handling of errors in rc files
## 23 Jan 2011, John Collins Fix detection of makeindex files with
## MiKTeX v >= 2.8
## 23 Jan 2011, John Collins Fix detection of biber use with MiKTeX
@@ -1343,7 +1344,6 @@ while ($_ = $ARGV[0])
process_rc_file( $ARGV[0] );
}
else {
- $! = 11;
die "$My_name: RC file [$ARGV[0]] does not exist\n";
}
shift;
@@ -2540,57 +2540,37 @@ CHANGE:
sub process_rc_file {
# Usage process_rc_file( filename )
+ # NEW VERSION
# Run rc_file whose name is given in first argument
- # Exit with code 11 if file could not be read.
- # (In general this is not QUITE the right error)
- # Exit with code 13 if there is a syntax error or other problem.
- # ???Should I leave the exiting to the caller (perhaps as an option)?
- # But I can always catch it with an eval if necessary.
- # That confuses ctrl/C and ctrl/break handling.
+ # Exit with code 0 on success
+ # Exit with code 1 if file could not be read.
+ # Stop if there is a syntax error or other problem.
my $rc_file = $_[0];
- warn "$My_name: Executing PERL code in file '$rc_file'...\n"
+ my $ret_code = 0;
+ warn "$My_name: Executing Perl code in file '$rc_file'...\n"
if $diagnostics;
- do( $rc_file );
- # The return value from the do is not useful, since it is the value of
- # the last expression evaluated, which could be anything.
- # The correct test of errors is on the values of $! and $@.
-
-# This is not entirely correct. On gluon2:
-# rc_file does open of file, and $! has error, apparently innocuous
-# See ~/proposal/06/latexmkrc-effect
-
- my $OK = 1;
- if ( $! ) {
- # Get both numeric error and its string, by forcing numeric and
- # string contexts:
- my $err_no = $!+0;
- my $err_string = "$!";
- warn "$My_name: Initialization file '$rc_file' could not be read,\n",
- " or it gave some other problem. Error code \$! = $err_no.\n",
- " Error string = '$err_string'\n";
- $! = 256;
- $OK = 0;
+ if ( ! -r $rc_file ) {
+ return 1;
}
+ do( $rc_file );
if ( $@ ) {
- $! = 256;
- # Indent the error message to make it easier to locate
- my $indented = prefix( $@, " " );
- $@ = "";
+ # Indent each line of possibly multiline message:
+ my $message = prefix( $@, " " );
warn "$My_name: Initialization file '$rc_file' gave an error:\n",
- "$indented";
- $OK = 0;
- }
- if ( ! $OK ) {
- die "$My_name: Stopping because of problem with rc file\n";
+ "$message\n";
+ die "$My_name: Stopping because of problem with rc file\n";
+ # Use the following if want non-fatal error.
+ return 2;
}
+ return 0;
} #END process_rc_file
#************************************************************
sub execute_code_string {
# Usage execute_code_string( string_of_code )
- # Run the PERL code contained in first argument
- # Exit with code 13 if there is a syntax error or other problem.
+ # Run the perl code contained in first argument
+ # Halt if there is a syntax error or other problem.
# ???Should I leave the exiting to the caller (perhaps as an option)?
# But I can always catch it with an eval if necessary.
# That confuses ctrl/C and ctrl/break handling.
@@ -2601,18 +2581,16 @@ sub execute_code_string {
eval $code;
# The return value from the eval is not useful, since it is the value of
# the last expression evaluated, which could be anything.
- # The correct test of errors is on the values of $! and $@.
+ # The correct test of errors is on the value of $@.
if ( $@ ) {
- $! = 256;
- my $message = $@;
- $@ = "";
- $message =~ s/\s*$//;
+ # Indent each line of possibly multiline message:
+ my $message = prefix( $@, " " );
die "$My_name: ",
"Stopping because executing following code from command line\n",
" $code\n",
"gave an error:\n",
- " $message\n";
+ "$message\n";
}
} #END execute_code_string