X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dcb68102796280b3e54979ae95738089914ce842..dc497201eb08e3de1402480e2ab97a6405335ecb:/src/cocoa/utilsexc.mm diff --git a/src/cocoa/utilsexc.mm b/src/cocoa/utilsexc.mm index 7d01c682fc..5d7fe82113 100644 --- a/src/cocoa/utilsexc.mm +++ b/src/cocoa/utilsexc.mm @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: utilsexec.mm +// Name: src/cocoa/utilsexec.mm // Purpose: Execution-related utilities for wxCocoa // Author: Ryan Norton // Modified by: @@ -7,11 +7,17 @@ // RCS-ID: $Id$ // Copyright: (c) Ryan Norton // Licence: wxWindows licence +// Notes: This code may be useful on platforms other than Darwin. +// On Darwin we share the CoreFoundation code with wxMac. ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation +#include "wx/wxprec.h" +#ifndef WX_PRECOMP #endif +#include "wx/unix/execute.h" +#include "wx/utils.h" + +#if 0 #include "wx/utils.h" @@ -23,6 +29,13 @@ #import #import +// +// RN: This is a prelimenary implementation - simple +// launching and process redirection works, +// but with the piping tests in the exec sample +// SIGPIPE is triggered... +// + class wxPipeInputStream : public wxInputStream { public: @@ -119,8 +132,8 @@ protected: @end long wxExecute(const wxString& command, - int sync = wxEXEC_ASYNC, - wxProcess *handle = NULL) + int sync, + wxProcess *handle) { NSTask* theTask = [[NSTask alloc] init]; @@ -142,21 +155,21 @@ long wxExecute(const wxString& command, NSArray* theQuoteArguments = [wxNSStringWithWxString(command) componentsSeparatedByString:@"\""]; - NSMutableArray* theSeperatedArguments = + NSMutableArray* theSeparatedArguments = [NSMutableArray arrayWithCapacity:10]; for (unsigned i = 0; i < [theQuoteArguments count]; ++i) { - [theSeperatedArguments addObjectsFromArray: + [theSeparatedArguments addObjectsFromArray: [[theQuoteArguments objectAtIndex:i] componentsSeparatedByString:@" "] ]; if(++i < [theQuoteArguments count]) - [theSeperatedArguments addObject:[theQuoteArguments objectAtIndex:i]]; + [theSeparatedArguments addObject:[theQuoteArguments objectAtIndex:i]]; } - [theTask setLaunchPath:[theSeperatedArguments objectAtIndex:0]]; - [theTask setArguments:theSeperatedArguments]; + [theTask setLaunchPath:[theSeparatedArguments objectAtIndex:0]]; + [theTask setArguments:theSeparatedArguments]; [theTask launch]; if(sync & wxEXEC_ASYNC) @@ -172,4 +185,6 @@ long wxExecute(const wxString& command, return [theTask terminationStatus]; } -} \ No newline at end of file +} +#endif //0 +