summaryrefslogtreecommitdiff
path: root/lib/perl5db.pl
diff options
context:
space:
mode:
authorBo Lindbergh <blgl@hagernas.com>2007-11-16 16:50:52 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-17 12:55:15 +0000
commitd457cffc915073c48e19f5f4202609a2fb18bb30 (patch)
tree31400fea90769c5dbb284b1f426a8276dbaa3b9b /lib/perl5db.pl
parentdaaddde1e827fdc7e156d6285d089c179eb25348 (diff)
downloadperl-d457cffc915073c48e19f5f4202609a2fb18bb30.tar.gz
perl5db.pl update for Mac OS X 10.5
Message-Id: <EAF6EFA7-D069-4809-9060-B66A746BBEF2@hagernas.com> p4raw-id: //depot/perl@32361
Diffstat (limited to 'lib/perl5db.pl')
-rw-r--r--lib/perl5db.pl54
1 files changed, 43 insertions, 11 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 2b1c2a3869..2167f789a5 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -6140,21 +6140,38 @@ a new window.
# it creates, but since it appears frontmost and windows are enumerated
# front to back, we can use "first window" === "window 1".
#
-# There's no direct accessor for the tty device name, so we fiddle
-# with the window title options until it says what we want.
-#
# Since "do script" is implemented by supplying the argument (plus a
# return character) as terminal input, there's a potential race condition
# where the debugger could beat the shell to reading the command.
# To prevent this, we wait for the screen to clear before proceeding.
#
-# Tested and found to be functional in Mac OS X 10.3.9 and 10.4.8.
+# 10.3 and 10.4:
+# There's no direct accessor for the tty device name, so we fiddle
+# with the window title options until it says what we want.
+#
+# 10.5:
+# There _is_ a direct accessor for the tty device name, _and_ there's
+# a new possible component of the window title (the name of the settings
+# set). A separate version is needed.
-sub macosx_get_fork_TTY
-{
- my($pipe,$tty);
+my @script_versions=
- return unless open($pipe,'-|','/usr/bin/osascript','-e',<<'__SCRIPT__');
+ ([237, <<'__LEOPARD__'],
+tell application "Terminal"
+ do script "clear;exec sleep 100000"
+ tell first tab of first window
+ copy tty to thetty
+ set custom title to "forked perl debugger"
+ set title displays custom title to true
+ repeat while (length of first paragraph of (get contents)) > 0
+ delay 0.1
+ end repeat
+ end tell
+end tell
+thetty
+__LEOPARD__
+
+ [100, <<'__JAGUAR_TIGER__'],
tell application "Terminal"
do script "clear;exec sleep 100000"
tell first window
@@ -6164,16 +6181,31 @@ tell application "Terminal"
set title displays device name to true
set title displays custom title to true
set custom title to ""
- copy name to thetitle
+ copy "/dev/" & name to thetty
set custom title to "forked perl debugger"
repeat while (length of first paragraph of (get contents)) > 0
delay 0.1
end repeat
end tell
end tell
-"/dev/" & thetitle
-__SCRIPT__
+thetty
+__JAGUAR_TIGER__
+
+);
+
+sub macosx_get_fork_TTY
+{
+ my($version,$script,$pipe,$tty);
+ return unless $version=$ENV{TERM_PROGRAM_VERSION};
+ foreach my $entry (@script_versions) {
+ if ($version>=$entry->[0]) {
+ $script=$entry->[1];
+ last;
+ }
+ }
+ return unless defined($script);
+ return unless open($pipe,'-|','/usr/bin/osascript','-e',$script);
$tty=readline($pipe);
close($pipe);
return unless defined($tty) && $tty =~ m(^/dev/);