JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
JSimpleProcess Class Reference

#include <JSimpleProcess.h>

Inheritance diagram for JSimpleProcess:
[legend]

Public Member Functions

 JSimpleProcess (const pid_t pid, const int fd, const bool deleteWhenFinished)
 
 ~JSimpleProcess () override
 
void SetMaxReportInterval (const time_t delta)
 
void ReportError (const bool success)
 
- Public Member Functions inherited from JProcess
 JProcess (const pid_t pid)
 
 ~JProcess () override
 
pid_t GetPID () const
 
JError GetPGID (pid_t *pgid) const
 
void Quit ()
 
void Kill ()
 
void WaitUntilFinished ()
 
bool IsFinished () const
 
bool SuccessfulFinish () const
 
bool GetFinishReason (JChildExitReason *reason, int *result) const
 
bool GetReturnValue (int *result) const
 
bool GetTermSignal (int *result) const
 
bool GetStopSignal (int *result) const
 
JError SendSignal (const int signal)
 
JError SendSignalToGroup (const int signal)
 
JError SetPriority (const int priority)
 
bool WillDeleteWhenFinished () const
 
void ShouldDeleteWhenFinished (const bool deleteObj=true)
 
bool WillQuitAtExit () const
 
void QuitAtExit (const bool quit=true)
 
bool WillKillAtExit () const
 
void KillAtExit (const bool kill=true)
 
- Public Member Functions inherited from JBroadcaster
 JBroadcaster ()
 
virtual ~JBroadcaster ()
 
JBroadcasteroperator= (const JBroadcaster &source)
 
bool HasSenders () const
 
JSize GetSenderCount () const
 
bool HasRecipients () const
 
JSize GetRecipientCount () const
 
virtual JString ToString () const
 
template<class T >
void ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f)
 

Static Public Member Functions

static JError Create (const JString &str, const bool detach)
 
static JError Create (const JPtrArray< JString > &argList, const bool detach)
 
static JError Create (const JUtf8Byte *argv[], const JSize size, const bool detach)
 
static JError Create (const JString &workingDirectory, const JString &str, const bool detach)
 
static JError Create (const JString &workingDirectory, const JPtrArray< JString > &argList, const bool detach)
 
static JError Create (const JString &workingDirectory, const JUtf8Byte *argv[], const JSize size, const bool detach)
 
static JError Create (JSimpleProcess **process, const JString &str, const bool deleteWhenFinished=false)
 
static JError Create (JSimpleProcess **process, const JString &workingDirectory, const JString &str, const bool deleteWhenFinished=false)
 
static JError Create (JSimpleProcess **process, const JPtrArray< JString > &argList, const bool deleteWhenFinished=false)
 
static JError Create (JSimpleProcess **process, const JString &workingDirectory, const JPtrArray< JString > &argList, const bool deleteWhenFinished=false)
 
static JError Create (JSimpleProcess **process, const JUtf8Byte *argv[], const JSize size, const bool deleteWhenFinished=false)
 
static JError Create (JSimpleProcess **process, const JString &workingDirectory, const JUtf8Byte *argv[], const JSize size, const bool deleteWhenFinished=false)
 
- Static Public Member Functions inherited from JProcess
static JError Create (JProcess **process, const JString &str, const JExecuteAction toAction=kJIgnoreConnection, int *toFD=nullptr, const JExecuteAction fromAction=kJIgnoreConnection, int *fromFD=nullptr, const JExecuteAction errAction=kJIgnoreConnection, int *errFD=nullptr)
 
static JError Create (JProcess **process, const JPtrArray< JString > &argList, const JExecuteAction toAction=kJIgnoreConnection, int *toFD=nullptr, const JExecuteAction fromAction=kJIgnoreConnection, int *fromFD=nullptr, const JExecuteAction errAction=kJIgnoreConnection, int *errFD=nullptr)
 
static JError Create (JProcess **process, const JUtf8Byte *argv[], const JSize size, const JExecuteAction toAction=kJIgnoreConnection, int *toFD=nullptr, const JExecuteAction fromAction=kJIgnoreConnection, int *fromFD=nullptr, const JExecuteAction errAction=kJIgnoreConnection, int *errFD=nullptr)
 
static JError Create (JProcess **process, const JString &workingDirectory, const JString &str, const JExecuteAction toAction=kJIgnoreConnection, int *toFD=nullptr, const JExecuteAction fromAction=kJIgnoreConnection, int *fromFD=nullptr, const JExecuteAction errAction=kJIgnoreConnection, int *errFD=nullptr)
 
static JError Create (JProcess **process, const JString &workingDirectory, const JPtrArray< JString > &argList, const JExecuteAction toAction=kJIgnoreConnection, int *toFD=nullptr, const JExecuteAction fromAction=kJIgnoreConnection, int *fromFD=nullptr, const JExecuteAction errAction=kJIgnoreConnection, int *errFD=nullptr)
 
static JError Create (JProcess **process, const JString &workingDirectory, const JUtf8Byte *argv[], const JSize size, const JExecuteAction toAction=kJIgnoreConnection, int *toFD=nullptr, const JExecuteAction fromAction=kJIgnoreConnection, int *fromFD=nullptr, const JExecuteAction errAction=kJIgnoreConnection, int *errFD=nullptr)
 
static void CheckForFinishedChild (const bool block)
 

Protected Member Functions

void Receive (JBroadcaster *sender, const Message &message) override
 
- Protected Member Functions inherited from JBroadcaster
 JBroadcaster (const JBroadcaster &source)
 
void ListenTo (const JBroadcaster *sender)
 
void StopListening (const JBroadcaster *sender)
 
void ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember)
 
void StopListening (const JBroadcaster *sender, const std::type_info &messageType)
 
template<class T >
void Send (JBroadcaster *recipient, const T &message)
 
template<class T >
void Broadcast (const T &message)
 
void SendWithFeedback (JBroadcaster *recipient, Message *message)
 
void BroadcastWithFeedback (Message *message)
 
virtual void ReceiveWithFeedback (JBroadcaster *sender, Message *message)
 
virtual void ReceiveGoingAway (JBroadcaster *sender)
 

Additional Inherited Members

- Static Public Attributes inherited from JProcess
static const JUtf8BytekFinished = "Finished::JProcess"
 

Detailed Description

Interface for the JSimpleProcess class

Class to run a program and report to the user if an error occurs.
We use a JMessageProtocol to accumulate the text from the process
so the pipe doesn't fill up.

If the process runs for more than 5 seconds, we ignore errors because
the user will surely have forgotten about it by then.  If errors are
that important, it ought to have been run in an xterm!

Constructor & Destructor Documentation

◆ JSimpleProcess()

JSimpleProcess::JSimpleProcess ( const pid_t  pid,
const int  fd,
const bool  deleteWhenFinished 
)

◆ ~JSimpleProcess()

JSimpleProcess::~JSimpleProcess ( )
override

Member Function Documentation

◆ Create() [1/12]

JError JSimpleProcess::Create ( const JPtrArray< JString > &  argList,
const bool  detach 
)
static

◆ Create() [2/12]

JError JSimpleProcess::Create ( const JString cmdStr,
const bool  detach 
)
static

The versions that don't return a pointer to the object imply deleteWhenFinished and automatically report any error from JExecute().

◆ Create() [3/12]

JError JSimpleProcess::Create ( const JString workingDirectory,
const JPtrArray< JString > &  argList,
const bool  detach 
)
static

◆ Create() [4/12]

JError JSimpleProcess::Create ( const JString workingDirectory,
const JString str,
const bool  detach 
)
static

◆ Create() [5/12]

JError JSimpleProcess::Create ( const JString workingDirectory,
const JUtf8Byte argv[],
const JSize  size,
const bool  detach 
)
static

◆ Create() [6/12]

JError JSimpleProcess::Create ( const JUtf8Byte argv[],
const JSize  size,
const bool  detach 
)
static

◆ Create() [7/12]

JError JSimpleProcess::Create ( JSimpleProcess **  process,
const JPtrArray< JString > &  argList,
const bool  deleteWhenFinished = false 
)
static

◆ Create() [8/12]

JError JSimpleProcess::Create ( JSimpleProcess **  process,
const JString str,
const bool  deleteWhenFinished = false 
)
static

◆ Create() [9/12]

JError JSimpleProcess::Create ( JSimpleProcess **  process,
const JString workingDirectory,
const JPtrArray< JString > &  argList,
const bool  deleteWhenFinished = false 
)
static

◆ Create() [10/12]

JError JSimpleProcess::Create ( JSimpleProcess **  process,
const JString workingDirectory,
const JString str,
const bool  deleteWhenFinished = false 
)
static

◆ Create() [11/12]

JError JSimpleProcess::Create ( JSimpleProcess **  process,
const JString workingDirectory,
const JUtf8Byte argv[],
const JSize  size,
const bool  deleteWhenFinished = false 
)
static

◆ Create() [12/12]

JError JSimpleProcess::Create ( JSimpleProcess **  process,
const JUtf8Byte argv[],
const JSize  size,
const bool  deleteWhenFinished = false 
)
static

◆ Receive()

void JSimpleProcess::Receive ( JBroadcaster sender,
const Message message 
)
overrideprotectedvirtual

Process the given message from the given sender. This function is not pure virtual because not all classes will want to implement it.

Reimplemented from JBroadcaster.

◆ ReportError()

void JSimpleProcess::ReportError ( const bool  success)

◆ SetMaxReportInterval()

void JSimpleProcess::SetMaxReportInterval ( const time_t  delta)
inline

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