Revision: 28224
          http://sourceforge.net/p/bibdesk/svn/28224
Author:   hofman
Date:     2023-04-19 15:50:01 +0000 (Wed, 19 Apr 2023)
Log Message:
-----------
wait for tex task termination with 10 sec timeout when running tex task 
synchonously

Modified Paths:
--------------
    trunk/bibdesk/BDSKTeXTask.m

Modified: trunk/bibdesk/BDSKTeXTask.m
===================================================================
--- trunk/bibdesk/BDSKTeXTask.m 2023-04-19 13:57:33 UTC (rev 28223)
+++ trunk/bibdesk/BDSKTeXTask.m 2023-04-19 15:50:01 UTC (rev 28224)
@@ -503,8 +503,17 @@
             [[currentTask task] launch];
             
             if (synchronous) {
-                [[currentTask task] waitUntilExit];
-                success = [self invokePendingTasks];
+                NSDate *start = [[NSDate alloc] init];
+                while ([[currentTask task] isRunning]) {
+                    NSDate *next = [[NSDate alloc] 
initWithTimeIntervalSinceNow:0.1];
+                    if ([next timeIntervalSinceDate:start] > 10.1)
+                        [[currentTask task] terminate];
+                    else
+                        [[NSRunLoop currentRunLoop] 
runMode:NSDefaultRunLoopMode beforeDate:next];
+                    [next release];
+                }
+                [start release];
+                success = success && [self invokePendingTasks];
             } else if (currentTask) {
                 [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(taskFinished:) name:NSTaskDidTerminateNotification 
object:[currentTask task]];
             }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to