Patch for adding tmux implementation for get_fork_TTY to perl5db.pl #13602
Comments
From @rjbsI wanted to get this patch into RT so it's not just a message in my inbox. I'd like to consider it for 5.21. -- |
From @rjbsMessage RFC822: This is a multi-part message in MIME format... --Sig_/qOUV/BWdMO_ZTlRyuIiChMX This is a multi-part message in MIME format... --MP_/JXpXq80DMxq1ykK69Cqe8ud Hello everyone, I've attached a patch that allows users to (more easily) debug forking Thanks, --MP_/JXpXq80DMxq1ykK69Cqe8ud =46rom 2abf84b16931967f191aa62b981b7b782c32e9f5 Mon Sep 17 00:00:00 2001 lib/perl5db.pl | 42 ++++++++++++++++++++++++++++++++++++++++++ diff --git a/lib/perl5db.pl b/lib/perl5db.pl
+Creates a split window for subprocesses when a process running under the
=3Dhead2 C<create_IN_OUT($flags)> --MP_/JXpXq80DMxq1ykK69Cqe8ud-- --Sig_/qOUV/BWdMO_ZTlRyuIiChMX -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlG01/cACgkQUoGaR6SGEaqkxACgqMXJ8AFeVeLlriKgVfHLGu5h --Sig_/qOUV/BWdMO_ZTlRyuIiChMX-- |
From @rjbsHello everyone, I've attached a patch that allows users to (more easily) debug forking Thanks, |
From @rjbs0001-Implement-get_fork_TTY-for-tmux.patchFrom 2abf84b16931967f191aa62b981b7b782c32e9f5 Mon Sep 17 00:00:00 2001
From: Rob Hoelz <rob@hoelz.ro>
Date: Sun, 9 Jun 2013 21:25:09 +0200
Subject: [PATCH] Implement get_fork_TTY for tmux
---
lib/perl5db.pl | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 881a9ec..0fec3bf 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -1331,6 +1331,9 @@ if (not defined &get_fork_TTY) # only if no routine exists
{
*get_fork_TTY = \&xterm_get_fork_TTY; # use the xterm version
}
+ elsif ( $ENV{TMUX} ) {
+ *get_fork_TTY = \&tmux_get_fork_TTY;
+ }
elsif ( $^O eq 'os2' ) { # If this is OS/2,
*get_fork_TTY = \&os2_get_fork_TTY; # use the OS/2 version
}
@@ -7065,6 +7068,45 @@ sub macosx_get_fork_TTY
return $tty;
}
+=head3 C<tmux_get_fork_TTY>
+
+Creates a split window for subprocesses when a process running under the
+perl debugger in Tmux forks.
+
+=cut
+
+sub tmux_get_fork_TTY {
+ return unless $ENV{TMUX};
+
+ my $pipe;
+
+ my $status = open $pipe, '-|', 'tmux', 'split-window',
+ '-P', '-F', '#{pane_tty}', 'sleep 100000';
+
+ if ( !$status ) {
+ return;
+ }
+
+ my $tty = <$pipe>;
+ close $pipe;
+
+ if ( $tty ) {
+ chomp $tty;
+
+ if ( !defined $term ) {
+ require Term::ReadLine;
+ if ( !$rl ) {
+ $term = Term::ReadLine::Stub->new( 'perldb', $IN, $OUT );
+ }
+ else {
+ $term = Term::ReadLine->new( 'perldb', $IN, $OUT );
+ }
+ }
+ }
+
+ return $tty;
+}
+
=head2 C<create_IN_OUT($flags)>
Create a new pair of filehandles, pointing to a new TTY. If impossible,
--
1.8.3
|
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121333 (status was 'resolved')
Searchable as RT121333$
The text was updated successfully, but these errors were encountered: