blob: 1aab2b8b41565979e77fb53536a560cd6f998527 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package Reply::Plugin::Interrupt;
use strict;
use warnings;
# ABSTRACT: allows using Ctrl+C to interrupt long-running lines
use base 'Reply::Plugin';
=head1 SYNOPSIS
; .replyrc
[Interrupt]
=head1 DESCRIPTION
This plugin allows you to use Ctrl+C to interrupt long running commands without
exiting the Reply shell entirely.
=cut
sub compile {
my $self = shift;
my ($next, @args) = @_;
local $SIG{INT} = sub { die "Interrupted" };
$next->(@args);
}
sub execute {
my $self = shift;
my ($next, @args) = @_;
local $SIG{INT} = sub { die "Interrupted" };
$next->(@args);
}
1;
|