diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/plat-mac/terminalcommand.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Lib/plat-mac/terminalcommand.py b/Lib/plat-mac/terminalcommand.py index 835a644..292f09c 100644 --- a/Lib/plat-mac/terminalcommand.py +++ b/Lib/plat-mac/terminalcommand.py @@ -28,26 +28,19 @@ SEND_MODE = kAENoReply # kAEWaitReply hangs when run from Terminal.app itself def run(command): """Run a shell command in a new Terminal.app window.""" termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG) - theEvent = AE.AECreateAppleEvent(kAEMiscStandards, kAEActivate, - termAddress, kAutoGenerateReturnID, - kAnyTransactionID) + theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress, + kAutoGenerateReturnID, kAnyTransactionID) + commandDesc = AE.AECreateDesc(typeChar, command) + theEvent.AEPutParamDesc(kAECommandClass, commandDesc) try: - theEvent.AESend(SEND_MODE, kAENormalPriority, - kAEDefaultTimeout) + theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) except AE.Error, why: if why[0] != -600: # Terminal.app not yet running raise os.system(START_TERMINAL) time.sleep(1) - theEvent.AESend(SEND_MODE, kAENormalPriority, - kAEDefaultTimeout) - - theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress, - kAutoGenerateReturnID, kAnyTransactionID) - commandDesc = AE.AECreateDesc(typeChar, command) - theEvent.AEPutParamDesc(kAECommandClass, commandDesc) - theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) + theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) if __name__ == "__main__": |