Staging
v0.8.1
v0.8.1
https://github.com/python/cpython
Revision 50af011ca60c4021c78c766b85c1af9960d98f8f authored by Georg Brandl on 01 April 2012, 11:49:21 UTC, committed by Georg Brandl on 01 April 2012, 11:49:21 UTC
1 parent 2489167
Tip revision: 50af011ca60c4021c78c766b85c1af9960d98f8f authored by Georg Brandl on 01 April 2012, 11:49:21 UTC
Bump to 3.3.0a2.
Bump to 3.3.0a2.
Tip revision: 50af011
doscript.m
/*
* doscript.c
* PythonLauncher
*
* Created by Jack Jansen on Wed Jul 31 2002.
* Copyright (c) 2002 __MyCompanyName__. All rights reserved.
*
*/
#import <Cocoa/Cocoa.h>
#import <ApplicationServices/ApplicationServices.h>
#import "doscript.h"
extern int
doscript(const char *command)
{
char *bundleID = "com.apple.Terminal";
AppleEvent evt, res;
AEDesc desc;
OSStatus err;
[[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/Utilities/Terminal.app/"];
// Build event
err = AEBuildAppleEvent(kAECoreSuite, kAEDoScript,
typeApplicationBundleID,
bundleID, strlen(bundleID),
kAutoGenerateReturnID,
kAnyTransactionID,
&evt, NULL,
"'----':utf8(@)", strlen(command),
command);
if (err) {
NSLog(@"AEBuildAppleEvent failed: %d\n", err);
return err;
}
// Send event and check for any Apple Event Manager errors
err = AESendMessage(&evt, &res, kAEWaitReply, kAEDefaultTimeout);
AEDisposeDesc(&evt);
if (err) {
NSLog(@"AESendMessage failed: %d\n", err);
return err;
}
// Check for any application errors
err = AEGetParamDesc(&res, keyErrorNumber, typeSInt32, &desc);
AEDisposeDesc(&res);
if (!err) {
AEGetDescData(&desc, &err, sizeof(err));
NSLog(@"Terminal returned an error: %d", err);
AEDisposeDesc(&desc);
} else if (err == errAEDescNotFound) {
err = noErr;
} else {
NSLog(@"AEGetPArmDesc returned an error: %d", err);
}
return err;
}
Computing file changes ...