about summary refs log tree commit diff
path: root/src/osxlaunch
diff options
context:
space:
mode:
authorJoel de Vahl <joel@stalverk80.se>2007-12-19 21:32:58 +0000
committerJoel de Vahl <joel@stalverk80.se>2007-12-19 21:32:58 +0000
commit5669c11a0b651dd79e467de99b16971cbde7135b (patch)
treed5a4b1907e4fc90e00ee7eb28c7e4cb5edcc502b /src/osxlaunch
parent72ffd0ae8ac7f1b55497101c229839b04cd17d97 (diff)
downloadzcatch-5669c11a0b651dd79e467de99b16971cbde7135b.tar.gz
zcatch-5669c11a0b651dd79e467de99b16971cbde7135b.zip
start teewars by default on osx, no launcher yet
Diffstat (limited to 'src/osxlaunch')
-rw-r--r--src/osxlaunch/main.m23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/osxlaunch/main.m b/src/osxlaunch/main.m
index 5f3d6ab6..8d23f5b6 100644
--- a/src/osxlaunch/main.m
+++ b/src/osxlaunch/main.m
@@ -3,15 +3,20 @@
 
 @interface ServerView : NSTextView
 {
+	NSTask *task;
 	NSFileHandle *file;
 }
-- (void)listenTo: (NSFileHandle*)f;
+- (void)listenTo: (NSTask*)t;
 @end
 
 @implementation ServerView
-- (void)listenTo: (NSFileHandle*)f;
+- (void)listenTo: (NSTask*)t;
 {
-	file = f;
+	NSPipe *pipe;
+	task = t;
+    pipe = [NSPipe pipe];
+    [task setStandardOutput: pipe];
+    file = [pipe fileHandleForReading];
 
 	[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(outputNotification:) name: NSFileHandleReadCompletionNotification object: file];
 
@@ -35,6 +40,7 @@
 
 -(void)windowWillClose:(NSNotification *)notification
 {
+	[task terminate]
     [NSApp terminate:self];
 }
 @end
@@ -49,12 +55,6 @@ int main(int argc, char **argv)
 	NSTask *task;
     task = [[NSTask alloc] init];
 	[task setCurrentDirectoryPath: [mainBundle resourcePath]]; 
-	NSPipe *pipe;
-	NSFileHandle *file;
-    pipe = [NSPipe pipe];
-    [task setStandardOutput: pipe];
-    file = [pipe fileHandleForReading];
-
 
 	if(mod & optionKey)
 	{
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
 		[window setDelegate: view];
 		[window makeKeyAndOrderFront: nil];
 
-		[view listenTo: file];
+		[view listenTo: task];
 		[task setLaunchPath: [mainBundle pathForAuxiliaryExecutable: @"teewars_srv"]];
 		[task launch];
 		[NSApp run];
@@ -93,11 +93,8 @@ int main(int argc, char **argv)
 		// run client
 		[task setLaunchPath: [mainBundle pathForAuxiliaryExecutable: @"teewars"]];
 		[task launch];
-		[task waitUntilExit];
 	}
 
-
-
     [NSApp release];
     [pool release];
     return(EXIT_SUCCESS);