#include <string.h>
#ifndef __DARWIN__
-#define wxEXECUTE_WIN_MESSAGE 10000
-long wxExecute(const wxString& command, int flags, wxProcess *handler)
+#include "wx/mac/private.h"
+#include "LaunchServices.h"
+
+long wxExecute(const wxString& command, int flags, wxProcess *WXUNUSED(handler))
{
- // TODO
- wxFAIL_MSG( _T("wxExecute() not yet implemented") );
- return 0;
+ wxASSERT_MSG( flags == wxEXEC_ASYNC,
+ wxT("wxExecute: Only wxEXEC_ASYNC is supported") );
+
+ FSRef fsRef ;
+ OSErr err = noErr ;
+ err = wxMacPathToFSRef( command , &fsRef ) ;
+ if ( noErr == err )
+ {
+ err = LSOpenFSRef( &fsRef , NULL ) ;
+ }
+
+ // 0 means execution failed. Returning non-zero is a PID, but not
+ // on Mac where PIDs are 64 bits and won't fit in a long, so we
+ // return a dummy value for now.
+ return ( err == noErr ) ? -1 : 0;
}
+
#endif
#ifdef __DARWIN__
kernResult = task_for_pid(taskOfOurProcess,pid, &machPortForProcess);
if(kernResult != KERN_SUCCESS)
{
- wxLogDebug("no task_for_pid()");
+ wxLogDebug(wxT("no task_for_pid()"));
// try seeing if it is already dead or something
// FIXME: a better method would be to call the callback function
// from idle time until the process terminates. Of course, how