Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/dpkg-dev/scripts/Dpkg/Exit.pm

Issue 2411423002: Linux build: Use sysroot when calculating dependencies (Closed)
Patch Set: Update expected_deps Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright © 2002 Adam Heath <doogie@debian.org>
2 # Copyright © 2012-2013 Guillem Jover <guillem@debian.org>
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17 package Dpkg::Exit;
18
19 use strict;
20 use warnings;
21
22 our $VERSION = '1.01';
23
24 use Exporter qw(import);
25
26 our @EXPORT_OK = qw(push_exit_handler pop_exit_handler run_exit_handlers);
27
28 # XXX: Backwards compatibility, stop exporting on VERSION 2.00.
29 ## no critic (Variables::ProhibitPackageVars)
30 our @handlers = ();
31 ## use critic
32
33 =encoding utf8
34
35 =head1 NAME
36
37 Dpkg::Exit - program exit handlers
38
39 =head1 DESCRIPTION
40
41 The Dpkg::Exit module provides support functions to run handlers on exit.
42
43 =head1 FUNCTIONS
44
45 =over 4
46
47 =item push_exit_handler($func)
48
49 Register a code reference into the exit function handlers stack.
50
51 =cut
52
53 sub push_exit_handler {
54 my ($func) = shift;
55 push @handlers, $func;
56 }
57
58 =item pop_exit_handler()
59
60 Pop the last registered exit handler from the handlers stack.
61
62 =cut
63
64 sub pop_exit_handler {
65 pop @handlers;
66 }
67
68 =item run_exit_handlers()
69
70 Run the registered exit handlers.
71
72 =cut
73
74 sub run_exit_handlers {
75 &$_() foreach (reverse @handlers);
76 }
77
78 sub exit_handler {
79 run_exit_handlers();
80 exit(127);
81 }
82
83 $SIG{INT} = \&exit_handler;
84 $SIG{HUP} = \&exit_handler;
85 $SIG{QUIT} = \&exit_handler;
86
87 =back
88
89 =head1 CHANGES
90
91 =head2 Version 1.01
92
93 New functions: push_exit_handler(), pop_exit_handler(), run_exit_handlers()
94 Deprecated variable: @handlers
95
96 =cut
97
98 1;
OLDNEW
« no previous file with comments | « third_party/dpkg-dev/scripts/Dpkg/ErrorHandling.pm ('k') | third_party/dpkg-dev/scripts/Dpkg/File.pm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698