@@ -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 )
@@ -233,6 +236,12 @@ rcutils_start_process(
233236 const rcutils_string_array_t * args ,
234237 rcutils_allocator_t * allocator )
235238{
239+ #ifdef RCUTILS_NO_PROCESS_SUPPORT
240+ (void )args ;
241+ (void )allocator ;
242+ RCUTILS_SET_ERROR_MSG ("process support is disabled (RCUTILS_NO_PROCESS_SUPPORT)" );
243+ return NULL ;
244+ #else
236245 RCUTILS_CHECK_ARGUMENT_FOR_NULL (args , NULL );
237246 RCUTILS_CHECK_ARGUMENT_FOR_NULL (allocator , NULL );
238247 if (args -> size < 1 ) {
@@ -318,6 +327,7 @@ rcutils_start_process(
318327 allocator -> deallocate (argv , & allocator -> state );
319328 exit (127 );
320329#endif
330+ #endif // RCUTILS_NO_PROCESS_SUPPORT
321331}
322332
323333void
@@ -341,6 +351,12 @@ rcutils_process_close(rcutils_process_t * process)
341351rcutils_ret_t
342352rcutils_process_wait (const rcutils_process_t * process , int * exit_code )
343353{
354+ #ifdef RCUTILS_NO_PROCESS_SUPPORT
355+ (void )process ;
356+ (void )exit_code ;
357+ RCUTILS_SET_ERROR_MSG ("process support is disabled (RCUTILS_NO_PROCESS_SUPPORT)" );
358+ return RCUTILS_RET_ERROR ;
359+ #else
344360 RCUTILS_CHECK_ARGUMENT_FOR_NULL (process , RCUTILS_RET_INVALID_ARGUMENT );
345361
346362#if defined _WIN32 || defined __CYGWIN__
@@ -381,6 +397,7 @@ rcutils_process_wait(const rcutils_process_t * process, int * exit_code)
381397#endif
382398
383399 return RCUTILS_RET_OK ;
400+ #endif // RCUTILS_NO_PROCESS_SUPPORT
384401}
385402
386403#ifdef __cplusplus
0 commit comments