5#include "../core_export.h"
7#include "../event_handler.h"
20struct __init_process_message_box_message__;
26 namespace diagnostics {
52 void set_data(data* data) {data_ = data;}
71 template<typename fn_t>
73 data_->error_data_received_callback_+=(function);
74 return xtd::diagnostics::data_received_event_handler::operator+=(function);
90 template<
typename fn_t>
92 data_->error_data_received_callback_-=(function);
93 return data_received_event_handler::operator-=(function);
97 data* data_ =
nullptr;
107 void set_data(data* data) {data_ = data;}
126 template<typename fn_t>
128 data_->exit_callback_+=(function);
129 return xtd::event_handler::operator+=(function);
145 template<
typename fn_t>
147 data_->exit_callback_-=(function);
148 return xtd::event_handler::operator-=(function);
152 data* data_ =
nullptr;
162 void set_data(data* data) {data_ = data;}
181 template<typename fn_t>
183 data_->output_data_received_callback_+=(function);
184 return xtd::diagnostics::data_received_event_handler::operator+=(function);
200 template<
typename fn_t>
202 data_->output_data_received_callback_-=(function);
203 return xtd::diagnostics::data_received_event_handler::operator-=(function);
207 data* data_ =
nullptr;
798 std::optional<intptr_t> handle_ = 0;
802 std::unique_ptr<std::ostream> standard_input_;
803 std::unique_ptr<std::istream> standard_output_;
804 std::unique_ptr<std::istream> standard_error_;
808 bool enable_raising_events_ =
false;
809 std::optional<int32_t> exit_code_;
813 std::exception_ptr exception_pointer_;
815 std::shared_ptr<data> data_ = std::make_shared<data>();
816 friend __init_process_message_box_message__;
817 inline static xtd::delegate<void(
const ustring&)> message_box_message_;
Represents a process error data received event.
Definition process.h:50
xtd::diagnostics::data_received_event_handler & operator-=(const xtd::diagnostics::data_received_event_handler &handler) noexcept
Removes an handler to the event.
bool is_empty() const noexcept
Gets a value indicate if the event is empty.
xtd::diagnostics::data_received_event_handler & operator-=(const typename xtd::diagnostics::data_received_event_handler::function_t &function) noexcept
Removes a function to the event.
Represents a process exit event.
Definition process.h:105
bool is_empty() const noexcept
Gets a value indicate if the event is empty.
xtd::event_handler & operator-=(const typename xtd::event_handler::function_t &function) noexcept
Removes a function to the event.
xtd::event_handler & operator-=(const xtd::event_handler &handler) noexcept
Removes an handler to the event.
Represents a process output data received event.
Definition process.h:160
xtd::diagnostics::data_received_event_handler & operator-=(const xtd::diagnostics::data_received_event_handler &handler) noexcept
Removes an handler to the event.
bool is_empty() const noexcept
Gets a value indicate if the event is empty.
xtd::diagnostics::data_received_event_handler & operator-=(const typename xtd::diagnostics::data_received_event_handler::function_t &function) noexcept
Removes a function to the event.
Specifies a set of values that are used when you start a process.
Definition process_start_info.h:31
Provides access to local and remote processes and enables you to start and stop local system processe...
Definition process.h:41
output_data_received_event output_data_received
Occurs each time an application writes a line to its redirected xtd::diagnostics::process::standard_o...
Definition process.h:787
xtd::diagnostics::process_priority_class priority_class() const
Gets the overall priority category for the associated process.
virtual void on_exited()
Raises the xtd::diagnostics::process::exited event.
ustring process_name() const
Gets the name of the process.
void close()
Frees all the resources that are associated with this component.
std::istream & standard_output()
Gets a stream used to read the textual output of the application.
bool enable_raising_events() const
Gets whether the xtd::diagnostics::process::exited event should be raised when the process terminates...
static process start(const xtd::diagnostics::process_start_info &start_info)
Starts the process resource that is specified by the parameter containing process start information (...
int32_t base_priority() const
Gets the base priority xof the associated process.
process & priority_class(xtd::diagnostics::process_priority_class value)
Sets the overall priority category for the associated process.
void kill()
Immediately stops the associated process.
process & wait_for_exit(int32_t milliseconds)
Instructs the Process component to wait the specified number of milliseconds for the associated proce...
const xtd::diagnostics::process_start_info & start_info() const
Gets the properties to pass to the xtd::diagnostics::process::start() method of the xtd::diagnostics:...
process & enable_raising_events(bool value)
Sets whether the xtd::diagnostics::process::exited event should be raised when the process terminates...
process()
Initializes a new instance of the xtd::diagnostics::process class.
std::ostream & standard_input()
Gets a stream used to write the input of the application.
std::chrono::system_clock::time_point time_point
Represents a point in time.
Definition process.h:211
std::istream & standard_error()
Gets a stream used to read the error output of the application.
xtd::diagnostics::process_start_info & start_info()
Gets the properties to pass to the xtd::diagnostics::process::start() method of the xtd::diagnostics:...
int32_t id() const
Gets the unique identifier for the associated process.
bool has_exited() const
Gets a value indicating whether the associated process has been terminated.
static process start(const ustring &file_name, const ustring &arguments)
Starts a process resource by specifying the name of an application and a set of command-line argument...
error_data_received_event error_data_received
Occurs when an application writes to its redirected xtd::diagnostics::process::standard_error stream.
Definition process.h:774
time_point start_time() const
Gets the time that the associated process was started.
time_point exit_time() const
Gets the time that the associated process exited.
intptr_t handle() const
Gets the native handle of the associated process.
process & start_info(const xtd::diagnostics::process_start_info &value)
SGets the properties to pass to the xtd::diagnostics::process::start() method of the xtd::diagnostics...
ustring machine_name() const
Gets the name of the computer the associated process is running on.
bool start()
Starts (or reuses) the process resource that is specified by the xtd::diagnostics::process::start_inf...
exit_event exited
Occurs when a process exits.
Definition process.h:781
static process start(const ustring &file_name)
Starts a process resource by specifying the name of a document or application file and associates the...
int32_t exit_code() const
Gets the value that the associated process specified when it terminated.
process & wait_for_exit()
Instructs the xtd::diagnostics::process component to wait indefinitely for the associated process to ...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
Contains xtd::diagnostics::data_received_event_handler event handler.
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:33
xtd::delegate< void(object &sender, const xtd::diagnostics::data_received_event_args &e)> data_received_event_handler
Represents the method that will handle the xtd::diagnostics::process::output_data_received and xtd::d...
Definition data_received_event_handler.h:20
#define core_export_
Define shared library export.
Definition core_export.h:13
process_priority_class
Indicates the priority that the system associates with a process. This value, together with the prior...
Definition process_priority_class.h:19
@ normal
Specifies that the process has no special scheduling needs.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::diagnostics::process_priority_class enum class.
Contains xtd::diagnostics::process_start_info class.