diff options
Diffstat (limited to 'Master/texmf/scripts/texlive/tlmgr.pl')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index be5e5ef94a1..fab861a322a 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -38,7 +38,7 @@ BEGIN { $mydir =~ s,/[^/]*$,,; my $kpsewhichname; if (!$^O =~ /^MSWin/i) { - $ENV{"PATH"} = "$mydir:$ENV{PATH}"; + $ENV{"PATH"} = "$mydir;$ENV{PATH}"; $kpsewhichname = "kpsewhich.exe"; } else { $kpsewhichname = "kpsewhich"; @@ -408,6 +408,21 @@ sub execute_action { + +sub do_cmd_and_check { + my $cmd = shift; + info("running $cmd ... "); + my ($out, $ret) = TeXLive::TLUtils::run_cmd("$cmd 2>&1"); + if ($ret == 0) { + info("done\n"); + log("Output of $cmd:\n$out\n"); + } else { + info("\n"); + tlwarn("$cmd failed (status $ret), output:\n$out\n"); + } + return $ret; +} + # run external programs (mktexlsr, updmap-sys, etc.) as specified by the # keys in the RET hash. We return the number of unsuccessful runs, zero # if all ok. @@ -420,8 +435,7 @@ sub handle_ret_hash { my $errors = 0; if (exists $ret{'mktexlsr'}) { - info("running mktexlsr\n"); - $errors += system("mktexlsr"); + $errors += do_cmd_and_check("mktexlsr"); } if (exists $ret{'map'}) { @@ -431,12 +445,9 @@ sub handle_ret_hash { # been the documented way to add fonts for many years. If we called # create_updmap, such user maps would be lost. foreach my $m (@{$ret{'map'}}) { - my $cmd = "updmap-sys --nomkmap --nohash --$m"; - info("running $cmd\n"); - $errors += system($cmd); + $errors += do_cmd_and_check("updmap-sys --nomkmap --nohash --$m"); } - info("running updmap-sys once more\n"); - $errors += system("updmap-sys"); # runs mktexlsr. + $errors += do_cmd_and_check("updmap-sys"); # runs mktexlsr. } chomp(my $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`); @@ -454,15 +465,13 @@ sub handle_ret_hash { "$TEXMFSYSVAR/web2c/fmtutil.cnf", "$TEXMFLOCAL/web2c/fmtutil-local.cnf"); if ($opt_fmt && !$ret{'format-regenerate'}) { - info("running fmtutil-sys --missing\n"); - $errors += system("fmtutil-sys", "--missing"); + $errors += do_cmd_and_check("fmtutil-sys --missing"); } } # if (exists $ret{'format-regenerate'}) { my $a = $opt_fmt ? "--all" : "--refresh"; - info("running fmtutil-sys $a to regenerate formats\n"); - $errors += system("fmtutil-sys", $a); + $errors += do_cmd_and_check("fmtutil-sys $a"); } if (exists $ret{'language'}) { @@ -483,13 +492,12 @@ sub handle_ret_hash { $lang = "$TEXMFSYSVAR/tex/generic/config/$lang"; } if ($localtlpdb->option_create_formats) { - info("running fmtutil-sys --byhyphen $lang\n"); - $errors += system("fmtutil-sys", "--byhyphen", $lang); + $errors += do_cmd_and_check("fmtutil-sys --byhyphen $lang"); } } } - return $errors / 256; # we were accumulating wait statuses + return $errors; } |