Hi Robert,
and thank you for the update.
One proposal for implementing 'osg_system(.)', which is working on my side
(iOS), still relies on OSG_SYSTEM_SUPPORTED:
Code:
#include <osg/os_utils>
#if !defined(OSG_SYSTEM_SUPPORTED) && !defined(WIN32)
#include <spawn.h>
#endif
extern "C" {
int osg_system(const char* command)
{
#ifdef OSG_SYSTEM_SUPPORTED
return system(command);
#elif !defined(WIN32)
pid_t pid;
posix_spawn(&pid, command, NULL, NULL, NULL, NULL);
return waitpid(pid, NULL, 0);
#else
printf("osg_system(%s) not supported.\n", command);
#endif
}
}
If we aim to remove the OSG_SYSTEM_SUPPORTED, we could use the code below
instead:
Code:
#include <osg/os_utils>
#ifndef WIN32
#include <spawn.h>
#endif
extern "C" {
int osg_system(const char* command)
{
#ifdef WIN32
return system(command);
#else
pid_t pid;
posix_spawn(&pid, command, NULL, NULL, NULL, NULL);
return waitpid(pid, NULL, 0);
#endif
}
}
I am not 100% sure but, as far as I know, 'system(.)' should be always
available on Windows, so it could be safe to use it only for Windows and use
'posix_spawn(.)' on the other platforms, what do you think? posix_spawn should
work on any linux, right?
Alessandro
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72819#72819
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org