summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Paulmier <matt@mpaulmier.home>2018-08-01 13:08:22 +0200
committerMatthias Paulmier <matt@mpaulmier.home>2018-08-01 13:11:08 +0200
commitd4a8005fd2d5adddabf537d26f932192b226806f (patch)
tree9472d52d7845c103e2e4d34d6fafdc0d2afe78b2
parentbcbc407fb4338717316122c5fb0699cc472b61c0 (diff)
downloadautomake-d4a8005fd2d5adddabf537d26f932192b226806f.tar.gz
Move the END sub to another module
This fixes the warning we had in bcbc407fb where the STDOUT handle was closed and reopened.
-rwxr-xr-x[-rw-r--r--]bin/aclocal.in1
-rwxr-xr-xbin/automake.in1
-rw-r--r--lib/Automake/End.pm41
-rw-r--r--lib/Automake/General.pm25
-rw-r--r--lib/Automake/local.mk1
5 files changed, 45 insertions, 24 deletions
diff --git a/bin/aclocal.in b/bin/aclocal.in
index 722affa55..09d8b89de 100644..100755
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -34,6 +34,7 @@ use Automake::Channels;
use Automake::ChannelDefs;
use Automake::XFile;
use Automake::FileUtils;
+use Automake::End;
use File::Basename;
use File::Path ();
diff --git a/bin/automake.in b/bin/automake.in
index c0cfd1e6f..06c09f978 100755
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -59,6 +59,7 @@ use Automake::ConfVars;
use Automake::Configure_ac;
use Automake::DisjConditions;
use Automake::Errors;
+use Automake::End;
use Automake::File;
use Automake::FileUtils;
use Automake::General;
diff --git a/lib/Automake/End.pm b/lib/Automake/End.pm
new file mode 100644
index 000000000..9de7b1388
--- /dev/null
+++ b/lib/Automake/End.pm
@@ -0,0 +1,41 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+package Automake::End;
+
+use File::Basename;
+
+# Variable we share with the main package. Be sure to have a single
+# copy of them: using 'my' together with multiple inclusion of this
+# package would introduce several copies.
+use vars qw ($me);
+$me = basename ($0);
+
+# END
+# ---
+# Exit nonzero whenever closing STDOUT fails.
+sub END
+{
+ # This is required if the code might send any output to stdout
+ # E.g., even --version or --help. So it's best to do it unconditionally.
+ if (! close STDOUT)
+ {
+ print STDERR "$me: closing standard output: $!\n";
+ $? = 74; # EX_IOERR
+ return;
+ }
+}
+
+1;
diff --git a/lib/Automake/General.pm b/lib/Automake/General.pm
index 3a3eda255..d194bea12 100644
--- a/lib/Automake/General.pm
+++ b/lib/Automake/General.pm
@@ -19,33 +19,10 @@ use 5.006;
use strict;
use Exporter 'import';
-use File::Basename;
use vars qw (@EXPORT);
-@EXPORT = qw (&uniq &none $me);
-
-# Variable we share with the main package. Be sure to have a single
-# copy of them: using 'my' together with multiple inclusion of this
-# package would introduce several copies.
-use vars qw ($me);
-$me = basename ($0);
-
-# END
-# ---
-# Exit nonzero whenever closing STDOUT fails.
-sub END
-{
- # This is required if the code might send any output to stdout
- # E.g., even --version or --help. So it's best to do it unconditionally.
- if (! close STDOUT)
- {
- print STDERR "$me: closing standard output: $!\n";
- $? = 74; # EX_IOERR
- return;
- }
-}
-
+@EXPORT = qw (&uniq &none);
# @RES
# uniq (@LIST)
diff --git a/lib/Automake/local.mk b/lib/Automake/local.mk
index 6a5a7101d..6a40a1839 100644
--- a/lib/Automake/local.mk
+++ b/lib/Automake/local.mk
@@ -29,6 +29,7 @@ dist_perllib_DATA = \
%D%/Configure_ac.pm \
%D%/ConfVars.pm \
%D%/DisjConditions.pm \
+ %D%/End.pm \
%D%/Errors.pm \
%D%/File.pm \
%D%/FileUtils.pm \