[LON-CAPA-cvs] cvs: loncom /interface printout.pl
raeburn
raeburn at source.lon-capa.org
Sun Dec 7 16:27:06 EST 2025
raeburn Sun Dec 7 21:27:06 2025 EDT
Modified files:
/loncom/interface printout.pl
Log:
- unlink each .ps file used as the input for the next stage of PDF
generation, when that stage is complete.
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.177 loncom/interface/printout.pl:1.178
--- loncom/interface/printout.pl:1.177 Sat Nov 9 16:08:15 2024
+++ loncom/interface/printout.pl Sun Dec 7 21:27:06 2025
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
-# $Id: printout.pl,v 1.177 2024/11/09 16:08:15 raeburn Exp $
+# $Id: printout.pl,v 1.178 2025/12/07 21:27:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -472,9 +472,15 @@
#LaTeX successfully parsed tex file
+ my ($printfor,$file_id);
+ $printfor = $env{'user.name'}.'_'.$env{'user.domain'};
+ if ($name_file =~ /^\Q$printfor\E_printout_(.+)\.tex$/) {
+ $file_id = $1;
+ }
$name_file =~ s/\.tex/\.dvi/;
my $new_name_file = $name_file;
$new_name_file =~ s/\.dvi/\.ps/;
+ my $name_file_ps = $new_name_file;
# Explicitly include a switch for papertype, otherwise dvips will default
# to whatever is listed first in config.ps (which in most cases is a4).
my $papera;
@@ -633,12 +639,24 @@
&busy_wait_command("$comma $tempo_file 1>/dev/null 2>/dev/null",
"for $status_statement now Modifying PS layout",
\%prog_state,$tempo_file);
+ # unlink ps file after use as it can be large
+ if ($name_file_ps eq $printfor.'_printout_'.$file_id.'.ps') {
+ if (-e $name_file_ps) {
+ unlink($name_file_ps);
+ }
+ }
} elsif ($laystyle eq 'book' and $numberofcolumns eq '2') {
$comma = 'pstops '.$papera.' "2:0+1(0.48w,0)" '.$new_name_file;
&debug("PSTOPS command: $comma ");
&busy_wait_command("$comma $tempo_file 1>/dev/null 2>/dev/null",
"for $status_statement now Modifying PS layout",
- \%prog_state,$tempo_file);
+ \%prog_state,$tempo_file);
+ # unlink ps file after use as it can be large
+ if ($name_file_ps eq $printfor.'_printout_'.$file_id.'.ps') {
+ if (-e $name_file_ps) {
+ unlink($name_file_ps);
+ }
+ }
} else {
$ps_file=$new_name_file;
}
@@ -661,11 +679,21 @@
}
close(FFH);
close(FFHS);
- $ps_file=$new_ps_file;
+ # unlink ps file after use as it can be large
+ if ($ps_file =~ m{^\Q$printfor\E_printout_\Q$file_id\E(|temporar)\.ps$}) {
+ if (-e $ps_file) {
+ unlink($ps_file);
+ }
+ }
+ $ps_file=$new_ps_file;
&busy_wait_command("ps2pdf13 $ps_file $pdf_file 1>/dev/null 2>/dev/null",
"for $status_statement now Converting PS to PDF",
\%prog_state,$pdf_file);
-
+ # unlink ps file after use as it can be large
+ if ($ps_file =~ m{^new\Q$printfor\E_printout_\Q$file_id\E(|temporar)\.ps$}) {
+ unlink($ps_file);
+ }
+
my $texlog = $texfile;
my $texaux = $texfile;
my $texdvi = $texfile;
@@ -685,7 +713,7 @@
}
unlink($missfonts_file);
- }
+ }
} else {
print
'<p class="LC_error">'
More information about the LON-CAPA-cvs
mailing list