Repository: apache/arrow
File: cpp/src/arrow/testing/process.cc (C++)

Code before:
#  include <boost/asio/io_context.hpp>

#  ifdef BOOST_PROCESS_USE_V2
#    ifdef BOOST_PROCESS_NEED_SOURCE
// Workaround for https://github.com/boostorg/process/issues/312
#      define BOOST_PROCESS_V2_SEPARATE_COMPILATION
#      ifdef __APPLE__
#        include <sys/sysctl.h>
#      endif
#      include <boost/process/v2.hpp>
#      include <boost/process/v2/src.hpp>
#    else
#      include <boost/process/v2.hpp>
#    endif
#    include <unordered_map>
#  else
// We need BOOST_USE_WINDOWS_H definition with MinGW when we use
// boost/process.hpp. boost/process/detail/windows/handle_workaround.hpp
// doesn't work without BOOST_USE_WINDOWS_H with MinGW because MinGW
// doesn't provide __kernel_entry without winternl.h.
//
// See also:
// https://github.com/boostorg/process/blob/develop/include/boost/process/detail/windows/handle_workaround.hpp
#    ifdef __MINGW32__
#      define BOOST_USE_WINDOWS_H = 1
#      ifdef BOOST_PROCESS_HAVE_V2
#        include <boost/process/v1/args.hpp>
#        include <boost/process/v1/async.hpp>
#        include <boost/process/v1/async_system.hpp>
#        include <boost/process/v1/child.hpp>
#        include <boost/process/v1/cmd.hpp>
#        include <boost/process/v1/env.hpp>
#        include <boost/process/v1/environment.hpp>
#        include <boost/process/v1/error.hpp>
#        include <boost/process/v1/exe.hpp>
#        include <boost/process/v1/group.hpp>
#        include <boost/process/v1/handles.hpp>
#        include <boost/process/v1/io.hpp>
#        include <boost/process/v1/pipe.hpp>
#        include <boost/process/v1/search_path.hpp>
#        include <boost/process/v1/shell.hpp>
#        include <boost/process/v1/spawn.hpp>
#        include <boost/process/v1/start_dir.hpp>
#        include <boost/process/v1/system.hpp>
#      else
#        include <boost/process/v1.hpp>
#      endif
#    else
#      ifdef BOOST_PROCESS_HAVE_V1
#        include <boost/process/v1.hpp>
#      else

Review comment (suggestion):
we force V1 on Windows even if `BOOST_PROCESS_HAVE_V2` as per:
```
  if(BOOST_PROCESS_HAVE_V2
     AND # We can't use v2 API on Windows because v2 API doesn't support
         # process group[1] and GCS testbench uses multiple processes[2].
         #
         # [1] https://github.com/boostorg/process/issues/259
         # [2] https://github.com/googleapis/storage-testbench/issues/669
         (NOT WIN32)
     AND # We can't use v2 API with musl libc with Boost Process < 1.86
         # because Boost Process < 1.86 doesn't support musl libc[3].
         #
         # [3] https://github.com/boostorg/process/commit/aea22dbf6be1695ceb42367590b6ca34d9433500
         (NOT (ARROW_WITH_MUSL AND (Boost_VERSION VERSION_LESS 1.86))))
    target_compile_definitions(Boost::process INTERFACE "BOOST_PROCESS_USE_V2")
  endif()
```

Code after:
#  include <boost/asio/io_context.hpp>

#  ifdef BOOST_PROCESS_USE_V2
#    ifdef BOOST_PROCESS_NEED_SOURCE
// Workaround for https://github.com/boostorg/process/issues/312
#      define BOOST_PROCESS_V2_SEPARATE_COMPILATION
#      ifdef __APPLE__
#        include <sys/sysctl.h>
#      endif
#      include <boost/process/v2.hpp>
#      include <boost/process/v2/src.hpp>
#    else
#      include <boost/process/v2.hpp>
#    endif
#    include <unordered_map>
#  else
// We need BOOST_USE_WINDOWS_H definition with MinGW when we use
// boost/process.hpp. boost/process/detail/windows/handle_workaround.hpp
// doesn't work without BOOST_USE_WINDOWS_H with MinGW because MinGW
// doesn't provide __kernel_entry without winternl.h.
//
// See also:
// https://github.com/boostorg/process/blob/develop/include/boost/process/detail/windows/handle_workaround.hpp
#    ifdef __MINGW32__
#      define BOOST_USE_WINDOWS_H = 1
#    endif
#    ifdef BOOST_PROCESS_HAVE_V1
#      include <boost/process/v1/args.hpp>
#      include <boost/process/v1/async.hpp>
#      include <boost/process/v1/async_system.hpp>
#      include <boost/process/v1/child.hpp>
#      include <boost/process/v1/cmd.hpp>
#      include <boost/process/v1/env.hpp>
#      include <boost/process/v1/environment.hpp>
#      include <boost/process/v1/error.hpp>
#      include <boost/process/v1/exe.hpp>
#      include <boost/process/v1/group.hpp>
#      include <boost/process/v1/handles.hpp>
#      include <boost/process/v1/io.hpp>
#      include <boost/process/v1/pipe.hpp>
#      include <boost/process/v1/search_path.hpp>
#      include <boost/process/v1/shell.hpp>
#      include <boost/process/v1/spawn.hpp>
#      include <boost/process/v1/start_dir.hpp>
#      include <boost/process/v1/system.hpp>
#    else
#      include <boost/process.hpp>
#    endif
#  endif

#  ifdef __APPLE__