@@ -17,6 +17,8 @@ extern "C"
1717{
1818#endif
1919
20+ #include "rcutils/process.h"
21+
2022#include <errno.h>
2123#include <stdlib.h>
2224#include <string.h>
@@ -36,14 +38,15 @@ extern "C"
3638#pragma warning(pop)
3739#else
3840#include <libgen.h>
41+ #ifndef RCUTILS_NO_PROCESS_SUPPORT
3942#include <sys/wait.h>
43+ #endif
4044#include <unistd.h>
4145#endif
4246
4347#include "rcutils/allocator.h"
4448#include "rcutils/error_handling.h"
4549#include "rcutils/join.h"
46- #include "rcutils/process.h"
4750#include "rcutils/strdup.h"
4851
4952int rcutils_get_pid (void )
@@ -234,6 +237,12 @@ rcutils_start_process(
234237 const rcutils_string_array_t * args ,
235238 rcutils_allocator_t * allocator )
236239{
240+ #ifdef RCUTILS_NO_PROCESS_SUPPORT
241+ (void )args ;
242+ (void )allocator ;
243+ RCUTILS_SET_ERROR_MSG ("process support is disabled (RCUTILS_NO_PROCESS_SUPPORT)" );
244+ return NULL ;
245+ #else
237246 RCUTILS_CHECK_ARGUMENT_FOR_NULL (args , NULL );
238247 RCUTILS_CHECK_ARGUMENT_FOR_NULL (allocator , NULL );
239248 if (args -> size < 1 ) {
@@ -319,6 +328,7 @@ rcutils_start_process(
319328 allocator -> deallocate (argv , & allocator -> state );
320329 exit (127 );
321330#endif
331+ #endif // RCUTILS_NO_PROCESS_SUPPORT
322332}
323333
324334void
@@ -342,6 +352,12 @@ rcutils_process_close(rcutils_process_t * process)
342352rcutils_ret_t
343353rcutils_process_wait (const rcutils_process_t * process , int * exit_code )
344354{
355+ #ifdef RCUTILS_NO_PROCESS_SUPPORT
356+ (void )process ;
357+ (void )exit_code ;
358+ RCUTILS_SET_ERROR_MSG ("process support is disabled (RCUTILS_NO_PROCESS_SUPPORT)" );
359+ return RCUTILS_RET_ERROR ;
360+ #else
345361 RCUTILS_CHECK_ARGUMENT_FOR_NULL (process , RCUTILS_RET_INVALID_ARGUMENT );
346362
347363#if defined _WIN32 || defined __CYGWIN__
@@ -382,6 +398,7 @@ rcutils_process_wait(const rcutils_process_t * process, int * exit_code)
382398#endif
383399
384400 return RCUTILS_RET_OK ;
401+ #endif // RCUTILS_NO_PROCESS_SUPPORT
385402}
386403
387404#ifdef __cplusplus
0 commit comments