MiKTeX 23.10-next
A scalable TeX distribution
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
MiKTeX::Core::Process Class Referenceabstract

An instance of this class manages a child process. More...

#include <miktex/Core/Process.h>

Public Member Functions

virtual FILE * get_StandardInput ()=0
 
virtual FILE * get_StandardOutput ()=0
 
virtual FILE * get_StandardError ()=0
 
virtual void WaitForExit ()=0
 Waits for the process to finish. More...
 
virtual bool WaitForExit (int milliseconds)=0
 
virtual ProcessExitStatus get_ExitStatus () const =0
 
virtual int get_ExitCode () const =0
 
virtual bool get_Exception (MiKTeX::Core::MiKTeXException &ex) const =0
 
virtual void Close ()=0
 Frees all resources associated with this Process object. More...
 
virtual int GetSystemId ()=0
 
virtual std::unique_ptr< Processget_Parent ()=0
 
virtual std::string get_ProcessName ()=0
 
virtual ProcessInfo GetProcessInfo ()=0
 

Static Public Member Functions

static std::unique_ptr< ProcessGetCurrentProcess ()
 
static std::unique_ptr< ProcessGetProcess (int systemId)
 
static std::vector< std::string > GetInvokerNames ()
 
static std::unique_ptr< ProcessStartSystemCommand (const std::string &commandLine, FILE **ppFileStandardInput, FILE **ppFileStandardOutput)
 
static void StartSystemCommand (const std::string &commandLine)
 
static bool ExecuteSystemCommand (const std::string &commandLine)
 
static bool ExecuteSystemCommand (const std::string &commandLine, int *exitCode)
 
static bool ExecuteSystemCommand (const std::string &commandLine, int *exitCode, IRunProcessCallback *callback, const char *workingDirectory)
 
static void Run (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments)
 
static void Run (const MiKTeX::Util::PathName &fileName)
 
static void Run (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments, IRunProcessCallback *callback)
 
static bool Run (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments, IRunProcessCallback *callback, int *exitCode, MiKTeXException *miktexException, const char *workingDirectory)
 
static bool Run (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments, std::function< bool(const void *, std::size_t)> callback, int *exitCode, MiKTeXException *miktexException, const char *workingDirectory)
 
static bool Run (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments, IRunProcessCallback *callback, int *exitCode, const char *workingDirectory)
 
static std::unique_ptr< ProcessStart (const ProcessStartInfo &startinfo)
 
static void Start (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments, FILE *pFileStandardInput, FILE **ppFileStandardInput, FILE **ppFileStandardOutput, FILE **ppFileStandardError, const char *workingDirectory)
 
static void Start (const MiKTeX::Util::PathName &fileName)
 
static void Start (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments)
 
static void Overlay (const MiKTeX::Util::PathName &fileName, const std::vector< std::string > &arguments)
 

Detailed Description

An instance of this class manages a child process.

Member Function Documentation

◆ Close()

virtual void MiKTeX::Core::Process::Close ( )
pure virtual

Frees all resources associated with this Process object.

◆ ExecuteSystemCommand() [1/3]

static bool MiKTeX::Core::Process::ExecuteSystemCommand ( const std::string &  commandLine)
static

Runs the system shell to execute a command.

Parameters
commandLineThe command (and arguments) to be executed.
Returns
Returns true, if the command exited successfull.

◆ ExecuteSystemCommand() [2/3]

static bool MiKTeX::Core::Process::ExecuteSystemCommand ( const std::string &  commandLine,
int *  exitCode 
)
static

Runs the system shell to execute a command.

Parameters
commandLineThe command (and arguments) to be executed.
[out]exitCodeThe exit code of the command.
Returns
Returns true, if the process exited successfully, or if exitCode isn't nullptr.

◆ ExecuteSystemCommand() [3/3]

static bool MiKTeX::Core::Process::ExecuteSystemCommand ( const std::string &  commandLine,
int *  exitCode,
IRunProcessCallback callback,
const char *  workingDirectory 
)
static

Runs the system shell to execute a command.

Parameters
commandLineThe command (and arguments) to be executed.
[out]exitCodeThe exit code of the command.
callbackThe pointer to a callback interface.
workingDirectoryWorking directory for the command.
Returns
Returns true, if the process exited successfully, or if exitCode isn't nullptr.

◆ get_Exception()

virtual bool MiKTeX::Core::Process::get_Exception ( MiKTeX::Core::MiKTeXException &  ex) const
pure virtual

Gets the MiKTeX exception thrown by the process.

Parameters
[out]exThe MiKTeX exception.

◆ get_ExitCode()

virtual int MiKTeX::Core::Process::get_ExitCode ( ) const
pure virtual

Gets the exit code of the process.

Returns
Returns the exit code.

◆ get_ExitStatus()

virtual ProcessExitStatus MiKTeX::Core::Process::get_ExitStatus ( ) const
pure virtual

Gets the exit status of the process.

Returns
Returns the exit status.

◆ get_Parent()

virtual std::unique_ptr< Process > MiKTeX::Core::Process::get_Parent ( )
pure virtual

Gets the parent process of this process.

Returns
Returns a smart pointer to the parent process.

◆ get_ProcessName()

virtual std::string MiKTeX::Core::Process::get_ProcessName ( )
pure virtual

Gets the name of this process.

Returns
Returns the process name.

◆ get_StandardError()

virtual FILE * MiKTeX::Core::Process::get_StandardError ( )
pure virtual

Gets the redirected stderr.

Returns
Returns a pointer to an output FILE object. Returns nullptr, if the error output was not redirected.

◆ get_StandardInput()

virtual FILE * MiKTeX::Core::Process::get_StandardInput ( )
pure virtual

Gets the redirected stdin.

Returns
Returns a pointer to an input FILE object. Returns nullptr, if the input was not redirected.

◆ get_StandardOutput()

virtual FILE * MiKTeX::Core::Process::get_StandardOutput ( )
pure virtual

Gets the redirected stdout.

Returns
Returns a pointer to an output FILE object. Returns nullptr, if the output was not redirected.

◆ GetCurrentProcess()

static std::unique_ptr< Process > MiKTeX::Core::Process::GetCurrentProcess ( )
static

Gets the current process.

Returns
Returns s smart pointer to the current process.

◆ GetInvokerNames()

static std::vector< std::string > MiKTeX::Core::Process::GetInvokerNames ( )
static

Gets the invoker chain for this process.

Returns
Returns the invoker chain (parent process names) for this process.

◆ GetProcess()

static std::unique_ptr< Process > MiKTeX::Core::Process::GetProcess ( int  systemId)
static

Gets a process.

Parameters
systemIdIdentifies the process.
Returns
Returns a smart pointer to the requested process.

◆ GetProcessInfo()

virtual ProcessInfo MiKTeX::Core::Process::GetProcessInfo ( )
pure virtual

Gets information about this process.

Returns
Returns the process information.

◆ GetSystemId()

virtual int MiKTeX::Core::Process::GetSystemId ( )
pure virtual

Gets the operating system identification of this process.

Returns
Returns the OS ID.

◆ Run() [1/6]

static void MiKTeX::Core::Process::Run ( const MiKTeX::Util::PathName fileName)
inlinestatic

Executes a process.

Parameters
fileNameThe name of an executable file to run in the process.

◆ Run() [2/6]

static void MiKTeX::Core::Process::Run ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments 
)
static

Executes a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.

◆ Run() [3/6]

static void MiKTeX::Core::Process::Run ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments,
IRunProcessCallback callback 
)
static

Executes a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.
callbackPointer to a callback interface.

◆ Run() [4/6]

static bool MiKTeX::Core::Process::Run ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments,
IRunProcessCallback callback,
int *  exitCode,
const char *  workingDirectory 
)
inlinestatic

Executes a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.
callbackThe pointer to a callback interface.
[out]exitCodeThe exit code of the process.
workingDirectoryWorking directory for the command.
Returns
Returns true, if the process exited successfully, or if exitCode isn't nullptr.

◆ Run() [5/6]

static bool MiKTeX::Core::Process::Run ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments,
IRunProcessCallback callback,
int *  exitCode,
MiKTeXException *  miktexException,
const char *  workingDirectory 
)
static

Executes a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.
callbackThe pointer to a callback interface.
[out]exitCodeThe exit code of the process.
[out]miktexExceptionThe MiKTeX exception thrown by the process.
workingDirectoryWorking directory for the command.
Returns
Returns true, if the process exited successfully, or if exitCode isn't nullptr.

◆ Run() [6/6]

static bool MiKTeX::Core::Process::Run ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments,
std::function< bool(const void *, std::size_t)>  callback,
int *  exitCode,
MiKTeXException *  miktexException,
const char *  workingDirectory 
)
static

Executes a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.
callbackThe pointer to a callback interface.
[out]exitCodeThe exit code of the process.
[out]miktexExceptionThe MiKTeX exception thrown by the process.
workingDirectoryWorking directory for the command.
Returns
Returns true, if the process exited successfully, or if exitCode isn't nullptr.

◆ Start() [1/4]

static void MiKTeX::Core::Process::Start ( const MiKTeX::Util::PathName fileName)
inlinestatic

Starts a process.

Parameters
fileNameThe name of an executable file to run in the process.

◆ Start() [2/4]

static void MiKTeX::Core::Process::Start ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments 
)
inlinestatic

Starts a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.

◆ Start() [3/4]

static void MiKTeX::Core::Process::Start ( const MiKTeX::Util::PathName fileName,
const std::vector< std::string > &  arguments,
FILE *  pFileStandardInput,
FILE **  ppFileStandardInput,
FILE **  ppFileStandardOutput,
FILE **  ppFileStandardError,
const char *  workingDirectory 
)
static

Starts a process.

Parameters
fileNameThe name of an executable file to run in the process.
argumentsThe command-line arguments to pass when starting the process.
pFileStandardInputOptional pointer to the input FILE stream for stdin redirection.
[out]ppFileStandardInputAn optional pointer to the input FILE stream for stdin redirection.
[out]ppFileStandardOutputAn optional pointer to the output FILE for stdout redirection.
[out]ppFileStandardErrorAn optional pointer to the error output FILE for stderr redirection.
workingDirectoryOptional working directory for the command.

◆ Start() [4/4]

static std::unique_ptr< Process > MiKTeX::Core::Process::Start ( const ProcessStartInfo startinfo)
static

Starts a process.

Parameters
startInfoThe process start options.
Returns
Returns a smart pointer to the process.

◆ StartSystemCommand() [1/2]

static void MiKTeX::Core::Process::StartSystemCommand ( const std::string &  commandLine)
inlinestatic

Starts the system shell to execute a command.

Parameters
commandLineThe command (and arguments) to be executed.

◆ StartSystemCommand() [2/2]

static std::unique_ptr< Process > MiKTeX::Core::Process::StartSystemCommand ( const std::string &  commandLine,
FILE **  ppFileStandardInput,
FILE **  ppFileStandardOutput 
)
static

Starts the system shell to execute a command.

Parameters
commandLineThe command (and arguments) to be executed.

◆ WaitForExit() [1/2]

virtual void MiKTeX::Core::Process::WaitForExit ( )
pure virtual

Waits for the process to finish.

◆ WaitForExit() [2/2]

virtual bool MiKTeX::Core::Process::WaitForExit ( int  milliseconds)
pure virtual

Waits for the process to finish.

Parameters
millisecondsThe maximum time to wait.
Returns
Returns true, if the process has finished.

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