Skip to content

Commit

Permalink
On OSX the finder will return from an open() event before the applica…
Browse files Browse the repository at this point in the history
…tion

has actually entered its event loop. As a stopgap, allow for a 10 second
grace period.
  • Loading branch information
jackjansen committed Mar 28, 2003
1 parent d4885f8 commit d6ab153
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Lib/plat-mac/aetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
from Carbon import AppleEvents
import MacOS
import sys
import time

from aetypes import *
from aepack import packkey, pack, unpack, coerce, AEDescType

Error = 'aetools.Error'

# Amount of time to wait for program to be launched
LAUNCH_MAX_WAIT_TIME=10

# Special code to unpack an AppleEvent (which is *not* a disguised record!)
# Note by Jack: No??!? If I read the docs correctly it *is*....

Expand Down Expand Up @@ -174,6 +178,14 @@ def _start(self):
self.send('ascr', 'noop')
except AE.Error:
_launch(self.target_signature)
for i in range(LAUNCH_MAX_WAIT_TIME):
try:
self.send('ascr', 'noop')
except AE.Error:
pass
else:
break
time.sleep(1)

def start(self):
"""Deprecated, used _start()"""
Expand Down

0 comments on commit d6ab153

Please sign in to comment.