Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Reference

Header <boost/process.hpp>
Header <boost/process/args.hpp>
Header <boost/process/async.hpp>
Header <boost/process/async_pipe.hpp>
Header <boost/process/async_system.hpp>
Header <boost/process/child.hpp>
Header <boost/process/cmd.hpp>
Header <boost/process/env.hpp>
Header <boost/process/environment.hpp>
Header <boost/process/error.hpp>
Header <boost/process/exception.hpp>
Header <boost/process/exe.hpp>
Header <boost/process/extend.hpp>
Header <boost/process/filesystem.hpp>
Header <boost/process/group.hpp>
Header <boost/process/handles.hpp>
Header <boost/process/io.hpp>
Header <boost/process/locale.hpp>
Header <boost/process/pipe.hpp>
Header <boost/process/posix.hpp>
Header <boost/process/search_path.hpp>
Header <boost/process/shell.hpp>
Header <boost/process/spawn.hpp>
Header <boost/process/start_dir.hpp>
Header <boost/process/system.hpp>
Header <boost/process/windows.hpp>

Convenience header which includes all public and platform-independent boost.process header files.

This header provides the args property. It also provides the alternative name argv .

 args;
     argv;
  }
}

The header which provides the basic asynchronous features. It provides the on_exit property, which allows callbacks when the process exits. It also implements the necessary traits for passing an boost::asio::io_context, which is needed for asynchronous communication.

It also pulls the boost::asio::buffer into the boost::process namespace for convenience.

 ;
     on_exit;
  }
}


  
    class async_pipe;
  }
}

Defines the asynchronous version of the system function.


  
    template<typename ExitHandler,  Args> 
       (, , 
                               );
  }
}

Defines a child process class.


  
    class child;

    typedef  ;  // Typedef for the type of an pid_t. 
  }
}

This header provides the cmd property.

 cmd;
  }
}

This header which provides the env property. It allows the modification of the environment the child process will run in, in a functional style.

 env;
  }
}

For additional information see the platform documentations:


  
    template<typename Char> class basic_environment;
    template<typename Char> class basic_native_environment;

    typedef basic_native_environment<  ;  // Definition of the environment for the current process. 
    typedef basic_native_environment<  ;  // Definition of the environment for the current process. 
    typedef basic_environment<  ;  // Type definition to hold a seperate environment. 
    typedef basic_environment<  ;  // Type definition to hold a seperate environment. 
  }
  

    // Get the process id of the current process. 
     ();

    // Get the native handle of the current process. 
     ();

    // Get the enviroment of the current process. 
     ();

    // Get the enviroment of the current process. 
     ();

    // Get the path environment variable of the current process runs. 
     ();
  }
}

Header which provides the error properties. It allows to explicitly set the error handling, the properties are:

 ignore_error;
     throw_on_error;
     error;
     error_ref;
     error_code;
  }
}

For error there are two aliases: error_ref and error_code


  
    struct process_error;
  }
}

Header which provides the exe property.

 exe;
  }
}

This header which provides the types and functions provided for custom extensions.

Please refer to the tutorial for more details.


  
    
      struct async_handler;
      struct handler;
      template<typename Sequence> struct posix_executor;
      struct require_io_context;
      template<typename Char, typename Sequence> struct windows_executor;

       on_setup;      // This handler is invoked before the process in launched, to setup parameters. The required signature is void(Exec &), where Exec is a template parameter. 
       on_error;      // This handler is invoked if an error occurred. The required signature is void(auto & exec, const std::error_code&), where Exec is a template parameter. 
       on_success;      // This handler is invoked if launching the process has succeeded. The required signature is void(auto & exec), where Exec is a template parameter. 
       on_fork_error;      // This handler is invoked if the fork failed. The required signature is void(auto & exec), where Exec is a template parameter. 
       on_exec_setup;      // This handler is invoked if the fork succeeded. The required signature is void(Exec &), where Exec is a template parameter. 
       on_exec_error;      // This handler is invoked if the exec call errored. The required signature is void(auto & exec), where Exec is a template parameter. 

      // Helper function to get the last error code system-independent. 
       ();
       ();
       ();
      template<typename Sequence> 
         ();
    }
  }
}

Defines a group process class. For additional information see the platform specific implementations:


  
    class group;
  }
}

Defines functions to obtain handles of the current process and limit the amount for inherited ones.


  
    static  limit_handles;
  }
  
    typedef  ;
     ();
     ( ec);
     ();
     ( handle,  ec);
  }
}

Header which provides the io properties. It provides the following properties:

 close;
     null;
     std_in;
     std_out;
     std_err;
  }
}

File I/O. 

The library allows full redirection of streams to files as shown below.

Synchronous Pipe I/O. 

Another way is to communicate through pipes.

Note that the pipe may also be used between several processes, like this:

Asynchronous I/O. 

Utilizing boost.asio asynchronous I/O is provided.

[Note] Note

boost/process/async.hpp must also be included for this to work.

Closing. 

Stream can be closed, so nothing can be read or written.

Null. 

Streams can be redirected to null, which means, that written date will be discarded and read data will only contain EOF.


  
    typedef  ;  // The internally used type for code conversion. 

    // Internally used error cateory for code conversion. 
     ();

    // Get a reference to the currently used code converter. 
     ();

    // Set the locale of the library. 
     ( loc);
  }
}

  
    template<typename CharT, typename Traits> class basic_ipstream;
    template<typename CharT, typename Traits> class basic_opstream;
    template<typename CharT, typename Traits> class basic_pipe;

    template<typename CharT, typename Traits> struct basic_pipebuf;

    template<typename CharT, typename Traits> class basic_pstream;

    typedef basic_pipe<  ;
    typedef basic_pipe<  ;
    typedef basic_pipebuf<  ;
    typedef basic_pipebuf<  ;
    typedef basic_ipstream<  ;
    typedef basic_ipstream<  ;
    typedef basic_opstream<  ;
    typedef basic_opstream<  ;
    typedef basic_pstream<  ;
    typedef basic_pstream<  ;
  }
}

Header which provides the posix extensions.

 fd;
       sig;
       use_vfork;
    }
  }
}

[Warning] Warning

Only available on posix. See the documentation of fork, execve and vfork.

Defines a function to search for an executable in path.


  
     
    (, 
                 = ::);
  }
}

Header which provides the shell property. This provides the property to launch a process through the system shell. It also allows the user to obtain the shell-path via shell().

 shell;
  }
}

Defines the spawn function.


  
    template< Args>  ();
  }
}

Header which provides the start_dir property, which allows to set the directory the process shall be started in.

 start_dir;
  }
}

Defines a system function.


  
    template< Args>  ();
  }
}

Header which provides the windows extensions.

 hide;
       maximized;
       minimized;
       minimized_not_active;
       not_active;
       show;
       show_normal;
       create_no_window;
    }
  }
}

[Warning] Warning

Only available on windows. See the parameter documentation of ShowWindow for more details.


PrevUpHomeNext