feisty meow concerns codebase  2.140
processes::launch_process Class Reference

Provides the capability to start processes in a variety of ways to run other applications. More...

#include <launch_process.h>

Inheritance diagram for processes::launch_process:
Collaboration diagram for processes::launch_process:

Public Types

enum  launch_flags {
  HIDE_APP_WINDOW = 0x1 , AWAIT_APP_EXIT = 0x2 , RETURN_IMMEDIATELY = 0x4 , AWAIT_VIA_POLLING = 0x8 ,
  SHELL_EXECUTE = 0x10
}
 

Public Member Functions

 DEFINE_CLASS_NAME ("launch_process")
 
virtual ~launch_process ()
 
- Public Member Functions inherited from basis::nameable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 

Static Public Member Functions

static basis::un_int run (const basis::astring &app_name, const basis::astring &command_line, int flag, basis::un_int &child_id)
 starts an application using the "app_name" as the executable to run. More...
 
static char_star_array break_line (basis::astring &app, const basis::astring &parameters)
 prepares an "app" to launch with the "parameters" (via exec). More...
 

Detailed Description

Provides the capability to start processes in a variety of ways to run other applications.

Definition at line 44 of file launch_process.h.

Member Enumeration Documentation

◆ launch_flags

Enumerator
HIDE_APP_WINDOW 

launches the application invisibly if possible.

AWAIT_APP_EXIT 

stays in the function until the launched application has exited.

RETURN_IMMEDIATELY 

starts the application and comes right back to the caller.

AWAIT_VIA_POLLING 

launches the app but polls and doesn't block on its exit.

SHELL_EXECUTE 

only valid on windows–uses ShellExecute instead of CreateProcess.

Definition at line 51 of file launch_process.h.

Constructor & Destructor Documentation

◆ ~launch_process()

virtual processes::launch_process::~launch_process ( )
inlinevirtual

Definition at line 49 of file launch_process.h.

Member Function Documentation

◆ break_line()

char_star_array processes::launch_process::break_line ( basis::astring app,
const basis::astring parameters 
)
static

prepares an "app" to launch with the "parameters" (via exec).

this breaks the strings for an application named "app" and its "parameters" into an array of char * that is appropriate for the execv function.

Definition at line 121 of file launch_process.cpp.

References basis::astring::end(), FUNCDEF, basis::array< contents >::last(), basis::astring::length(), LOG, NULL_POINTER, eml_to_txt::num, basis::astring::stuff(), basis::astring::substring(), and basis::astring::zap().

◆ DEFINE_CLASS_NAME()

processes::launch_process::DEFINE_CLASS_NAME ( "launch_process"  )

◆ run()

basis::un_int processes::launch_process::run ( const basis::astring app_name,
const basis::astring command_line,
int  flag,
basis::un_int child_id 
)
static

starts an application using the "app_name" as the executable to run.

the "command_line" is the set of parameters to be passed to the app. the return value is OS specific but can be identified using system_error_text(). usually a zero return means success and non-zero codes are errors. the "flag" is an XORed value from the process launch flags that dictates how the app is to be started. in practice, only the HIDE_APP_WINDOW flag can be combined with other values. if either AWAIT flag is used, then the return value will be the launched process's own exit value. the thread or process_id of the launched process is stored in "child_id" if appropriate.

Definition at line 166 of file launch_process.cpp.

References processes::__our_kids(), processes::__process_synchronizer(), basis::astring::end(), execv, FUNCDEF, basis::astring::insert(), LOG, basis::array< contents >::observe(), and basis::astring::s().


The documentation for this class was generated from the following files: