Hi Alessandro,

On 22 January 2018 at 10:51, Alessandro Terenzi <[email protected]> wrote:
> 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?

I think it'd work, but don't know how widely it'll be supported, what
I do know that it's only iOS so far that hasn't supported system() so
I'd be inclined to just use the posix_spawn fallback for iOS for now.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to