[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03-autom4te-interruption.patch
From: |
Akim Demaille |
Subject: |
03-autom4te-interruption.patch |
Date: |
Fri, 08 Mar 2002 12:47:49 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* bin/autom4te.in (&handle_m4): Protect us from corrupted file
because of C-c: have m4 output in tmp files, then mv them.
Index: bin/autom4te.in
--- bin/autom4te.in Thu, 07 Mar 2002 21:06:05 +0100 akim
+++ bin/autom4te.in Thu, 07 Mar 2002 21:21:28 +0100 akim
@@ -601,21 +601,34 @@ sub handle_m4 ($@)
#
# Be extremely cautious to reverse the includes when talking to M4:
# it doesn't speak the same --include as we do.
+ #
+ # We don't output directly to the cache files, to avoid problems
+ # when we are interrupted (that leaves corrupted files).
+ # In addition, GNU m4 appends when using --error-output.
my $command = ("$m4"
. join (' --include=', '', reverse @include)
. " --define=m4_warnings=$m4_warnings"
. ' --debug=aflq'
- . " --error-output=$tcache" . $req->id
+ . " --error-output=$tcache" . $req->id . "t"
. join (' --trace=', '', sort @macro)
. " @ARGV"
. ' </dev/null'
- . " >$ocache" . $req->id);
+ . " >$ocache" . $req->id . "t");
verbose "running: $command";
system $command;
if ($?)
{
verbose "$m4: failed with exit status: " . ($? >> 8) . "\n";
exit $? >> 8;
+ }
+
+ # Everything went ok: preserve the outputs.
+ foreach ($tcache, $ocache)
+ {
+ use File::Copy;
+ $_ .= $req->id;
+ move ("${_}t", "$_")
+ or die "$me: cannot not rename ${_}t as $_: $!\n";
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 03-autom4te-interruption.patch,
Akim Demaille <=