mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 03:02:28 +00:00
python-3.6.zip added from Github
README.cosmo contains the necessary links.
This commit is contained in:
parent
75fc601ff5
commit
0c4c56ff39
4219 changed files with 1968626 additions and 0 deletions
59
third_party/python/Mac/PythonLauncher/doscript.m
vendored
Normal file
59
third_party/python/Mac/PythonLauncher/doscript.m
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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: %ld\n", (long)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: %ld\n", (long)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: %ld", (long)err);
|
||||
AEDisposeDesc(&desc);
|
||||
} else if (err == errAEDescNotFound) {
|
||||
err = noErr;
|
||||
} else {
|
||||
NSLog(@"AEGetPArmDesc returned an error: %ld", (long)err);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue