]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Move the END sub to another module
authorMatthias Paulmier <matt@mpaulmier.home>
Wed, 1 Aug 2018 11:08:22 +0000 (13:08 +0200)
committerMatthias Paulmier <matt@mpaulmier.home>
Wed, 1 Aug 2018 11:11:08 +0000 (13:11 +0200)
This fixes the warning we had in bcbc407fb where the STDOUT handle was closed
and reopened.

bin/aclocal.in [changed mode: 0644->0755]
bin/automake.in
lib/Automake/End.pm [new file with mode: 0644]
lib/Automake/General.pm
lib/Automake/local.mk

old mode 100644 (file)
new mode 100755 (executable)
index 722affa..09d8b89
@@ -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 ();
 
index c0cfd1e6fed7c44d6cf9192798c3a9c265f9f722..06c09f978581851e936c0e64448701ef37fed89a 100755 (executable)
@@ -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 (file)
index 0000000..9de7b13
--- /dev/null
@@ -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;
index 3a3eda25518d0295cc2a8c3bcf70da983731774a..d194bea1235e8636f231892e31c176b5b7da68dc 100644 (file)
@@ -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)
index 6a5a7101db50abaa680dcceef22e382c0e24ceed..6a40a1839829c9bd48cfc9006f5b59b574321847 100644 (file)
@@ -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 \