Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
Hopefully safer simulation quitting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Holland committed Jun 25, 2010
1 parent 4a5a90c commit 845c369
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ext/iCuke/sdk3.1/QuitResponse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "iCukeHTTPResponseHandler.h"

@interface QuitResponse : iCukeHTTPResponseHandler {
}
@end
23 changes: 23 additions & 0 deletions ext/iCuke/sdk3.1/QuitResponse.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#import "QuitResponse.h"
#import "iCukeHTTPServer.h"
#import "JSON.h"

@implementation QuitResponse
+ (void)load
{
[iCukeHTTPResponseHandler registerHandler:self];
}

+ (BOOL)canHandleRequest:(CFHTTPMessageRef)aRequest
method:(NSString *)requestMethod
url:(NSURL *)requestURL
headerFields:(NSDictionary *)requestHeaderFields
{
return [requestURL.path isEqualToString:@"/quit"];
}

- (void)startResponse
{
exit(0);
}
@end
5 changes: 5 additions & 0 deletions ext/iCuke/sdk4.0/QuitResponse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "iCukeHTTPResponseHandler.h"

@interface QuitResponse : iCukeHTTPResponseHandler {
}
@end
23 changes: 23 additions & 0 deletions ext/iCuke/sdk4.0/QuitResponse.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#import "QuitResponse.h"
#import "iCukeHTTPServer.h"
#import "JSON.h"

@implementation QuitResponse
+ (void)load
{
[iCukeHTTPResponseHandler registerHandler:self];
}

+ (BOOL)canHandleRequest:(CFHTTPMessageRef)aRequest
method:(NSString *)requestMethod
url:(NSURL *)requestURL
headerFields:(NSDictionary *)requestHeaderFields
{
return [requestURL.path isEqualToString:@"/quit"];
}

- (void)startResponse
{
exit(0);
}
@end
5 changes: 2 additions & 3 deletions lib/icuke/waxsim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def launch(project_file, options = {})

command = ICuke::SDK.launch("#{directory}/#{app_name}.app", options[:platform], options[:env])
@simulator = BackgroundProcess.run(command)

timeout(30) do
begin
view
Expand All @@ -30,9 +30,8 @@ def launch(project_file, options = {})
end

def quit
@simulator.kill('QUIT')
get '/quit' rescue nil
@simulator.wait
sleep 1
end
end
end

0 comments on commit 845c369

Please sign in to comment.