Revision: 7794
http://skim-app.svn.sourceforge.net/skim-app/?rev=7794&view=rev
Author: hofman
Date: 2012-11-05 17:59:52 +0000 (Mon, 05 Nov 2012)
Log Message:
-----------
Always launch NSTask in a try block, as it can raise an exception, and discard
stdout and stderr
Modified Paths:
--------------
trunk/SKApplicationController.m
trunk/SKMainDocument.m
trunk/SKScriptMenu.m
Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m 2012-11-05 17:52:01 UTC (rev 7793)
+++ trunk/SKApplicationController.m 2012-11-05 17:59:52 UTC (rev 7794)
@@ -377,8 +377,8 @@
if (runImporter) {
NSString *mdimportPath = @"/usr/bin/mdimport";
if ([[NSFileManager defaultManager]
isExecutableFileAtPath:mdimportPath]) {
- [NSTask launchedTaskWithLaunchPath:mdimportPath
arguments:[NSArray arrayWithObjects:@"-r", importerPath, nil]];
-
+ @try { [NSTask launchedTaskWithLaunchPath:mdimportPath
arguments:[NSArray arrayWithObjects:@"-r", importerPath, nil]]; }
+ @catch(id exception) {}
NSDictionary *info = [NSDictionary
dictionaryWithObjectsAndKeys:[NSNumber numberWithLong:sysVersion],
SKSpotlightLastSysVersionKey, importerVersion,
SKSpotlightLastImporterVersionKey, nil];
[[NSUserDefaults standardUserDefaults] setObject:info
forKey:SKSpotlightVersionInfoKey];
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2012-11-05 17:52:01 UTC (rev 7793)
+++ trunk/SKMainDocument.m 2012-11-05 17:59:52 UTC (rev 7794)
@@ -1135,6 +1135,8 @@
[task setLaunchPath:@"/usr/bin/tar"];
[task setArguments:[NSArray arrayWithObjects:@"-czf", [fileURL path],
[[self fileURL] lastPathComponent], nil]];
[task setCurrentDirectoryPath:[[[self fileURL]
URLByDeletingLastPathComponent] path]];
+ [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]];
+ [task setStandardError:[NSFileHandle fileHandleWithNullDevice]];
SKAttachmentEmailer *emailer = nil;
if (email)
@@ -1182,6 +1184,8 @@
[task setLaunchPath:@"/usr/bin/hdiutil"];
[task setArguments:[NSArray arrayWithObjects:@"create", @"-srcfolder",
[[self fileURL] path], @"-format", @"UDZO", @"-volname", [[fileURL
lastPathComponent] stringByDeletingPathExtension], [fileURL path], nil]];
[task setCurrentDirectoryPath:[[[self fileURL]
URLByDeletingLastPathComponent] path]];
+ [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]];
+ [task setStandardError:[NSFileHandle fileHandleWithNullDevice]];
SKAttachmentEmailer *emailer = nil;
if (email)
Modified: trunk/SKScriptMenu.m
===================================================================
--- trunk/SKScriptMenu.m 2012-11-05 17:52:01 UTC (rev 7793)
+++ trunk/SKScriptMenu.m 2012-11-05 17:59:52 UTC (rev 7794)
@@ -251,15 +251,18 @@
NSString *scriptFilename = [sender representedObject];
NSString *theUTI = [[NSWorkspace sharedWorkspace]
typeOfFile:[[scriptFilename stringByStandardizingPath]
stringByResolvingSymlinksInPath] error:NULL];
- if (isAppleScriptUTI(theUTI)) {
- [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript"
arguments:[NSArray arrayWithObjects:scriptFilename, nil]];
- } else if (isApplicationUTI(theUTI)) {
- [[NSWorkspace sharedWorkspace] launchApplication:scriptFilename];
- } else if (isAutomatorWorkflowUTI(theUTI)) {
- [NSTask launchedTaskWithLaunchPath:@"/usr/bin/automator"
arguments:[NSArray arrayWithObjects:scriptFilename, nil]];
- } else if ([[NSFileManager defaultManager]
isExecutableFileAtPath:scriptFilename]) {
- [NSTask launchedTaskWithLaunchPath:scriptFilename arguments:[NSArray
array]];
+ @try {
+ if (isAppleScriptUTI(theUTI)) {
+ [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript"
arguments:[NSArray arrayWithObjects:scriptFilename, nil]];
+ } else if (isApplicationUTI(theUTI)) {
+ [[NSWorkspace sharedWorkspace] launchApplication:scriptFilename];
+ } else if (isAutomatorWorkflowUTI(theUTI)) {
+ [NSTask launchedTaskWithLaunchPath:@"/usr/bin/automator"
arguments:[NSArray arrayWithObjects:scriptFilename, nil]];
+ } else if ([[NSFileManager defaultManager]
isExecutableFileAtPath:scriptFilename]) {
+ [NSTask launchedTaskWithLaunchPath:scriptFilename
arguments:[NSArray array]];
+ }
}
+ @catch (id exception) {}
}
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit