-
Notifications
You must be signed in to change notification settings - Fork 7
process process
Alairion edited this page May 8, 2021
·
2 revisions
nes::process::process
(1) constexpr process() noexcept = default;
(2) explicit process(const std::string& path, const std::string& working_directory);
(3) explicit process(const std::string& path, process_options options);
(4) explicit process(const std::string& path, const std::vector<std::string>& args, process_options options);
(5) explicit process(const std::string& path, const std::string& working_directory, process_options options);
(6) explicit process(const std::string& path, std::vector<std::string> args = std::vector<std::string>{}, const std::string& working_directory = std::string{}, process_options options = process_options{});
(7) process(const process&) = delete;
(8) process(process&& other) noexcept;
- Constructs a new process object which does not represent a process.
- Delegates construction to (6) by calling
process{path, {}, working_directory, {}}
. - Delegates construction to (6) by calling
process{path, {}, {}, options}
. - Delegates construction to (6) by calling
process{path, args, {}, options}
. - Delegates construction to (6) by calling
process{path, {}, working_directory, options}
. - Constructs a new process object that represents a new process that is an image of the file located at
path
.args
is a vector of strings that is given to the child process main function.working_directory
is the child working directory.options
are additional flags which change the behaviour of the process creation. - Deleted copy-constructor.
- Move constructor. Initializes the new process with the content
other
. After this call,other
does no longer represents a valid process.
Name | Description |
---|---|
path |
An UTF-8 encoded string that represents the relative or absolute path where the executable file is located |
args |
If args is not empty, the child process will received args.size() + 1 arguments where the first one is path , otherwise the child process will received only one argument, which is path . Each string in args is an UTF-8 encoded string |
working_directory |
An UTF-8 encoded string that represents the relative or absolute path of the working directory of the child process. If working_directory is empty, the child's working directory is the same as the parent's |
options |
A combination of value of the nes::process_options enum |
- Explicit
- Explicit
- Explicit
- Explicit
- Explicit
- Does not throw.
- See (6)
- See (6)
- See (6)
- See (6)
- May throw a
std::runtime_error
if the process creation failed. - Deleted
- Does not throw
- On Windows, the process is created using
CreateProcessW
On Posix systems, the process is created usingfork
orvfork
(if possible) followed byexec