Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtCore.QProcess Class Reference

The QProcess class is used to start external programs and to communicate with them. More...

Inheritance diagram for QtCore.QProcess:
Collaboration diagram for QtCore.QProcess:

Public Types

enum  ExitStatus { CrashExit = 1, NormalExit = 0 }
  More...
 
enum  ProcessChannel { StandardError = 1, StandardOutput = 0 }
  More...
 
enum  ProcessChannelMode { ForwardedChannels = 2, MergedChannels = 1, SeparateChannels = 0 }
  More...
 
enum  ProcessError {
  Crashed = 1, FailedToStart = 0, ReadError = 3, Timedout = 2,
  UnknownError = 5, WriteError = 4
}
  More...
 
enum  ProcessState { NotRunning = 0, Running = 2, Starting = 1 }
  More...
 
- Public Types inherited from QtCore.QIODevice
enum  OpenModeFlag {
  Append = 4, NotOpen = 0, ReadOnly = 1, ReadWrite = 3,
  Text = 16, Truncate = 8, Unbuffered = 32, WriteOnly = 2
}
  More...
 

Public Member Functions

 QProcess (QObject parent=null)
  More...
 
override void CreateProxy ()
 
override void Close ()
  More...
 
new void CloseReadChannel (QProcess.ProcessChannel channel)
  More...
 
new void CloseWriteChannel ()
  More...
 
new QProcess.ProcessError Error ()
  More...
 
new int ExitCode ()
  More...
 
new QProcess.ExitStatus exitStatus ()
  More...
 
new void Kill ()
  More...
 
new QByteArray ReadAllStandardError ()
  More...
 
new QByteArray ReadAllStandardOutput ()
  More...
 
new void SetStandardErrorFile (string fileName, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.Truncate)
  More...
 
new void SetStandardInputFile (string fileName)
  More...
 
new void SetStandardOutputFile (string fileName, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.Truncate)
  More...
 
new void SetStandardOutputProcess (QProcess destination)
  More...
 
new void Start (string program, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
  More...
 
new void Start (string program, System.Collections.Generic.List< string > arguments, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
  More...
 
new void Terminate ()
  More...
 
override bool WaitForBytesWritten (int msecs=30000)
  More...
 
new bool WaitForFinished (int msecs=30000)
  More...
 
override bool WaitForReadyRead (int msecs=30000)
  More...
 
new bool WaitForStarted (int msecs=30000)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QIODevice
 QIODevice ()
  More...
 
 QIODevice (QObject parent)
  More...
 
new bool GetChar (Pointer< sbyte > c)
  More...
 
virtual bool Open (QIODevice.OpenModeFlag mode)
  More...
 
new QByteArray Peek (long maxlen)
  More...
 
new long Peek (Pointer< sbyte > data, long maxlen)
  More...
 
new bool PutChar (char c)
  More...
 
new QByteArray Read (long maxlen)
  More...
 
new long Read (Pointer< sbyte > data, long maxlen)
  More...
 
new QByteArray ReadAll ()
  More...
 
new QByteArray ReadLine (long maxlen=0)
  More...
 
new long ReadLine (Pointer< sbyte > data, long maxlen)
  More...
 
virtual bool Reset ()
  More...
 
virtual bool Seek (long pos)
  More...
 
new void SetTextModeEnabled (bool enabled)
  More...
 
new void UngetChar (char c)
  More...
 
new long Write (QByteArray data)
  More...
 
new long Write (string data)
  More...
 
new long Write (string data, long len)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
  More...
 
new bool BlockSignals (bool b)
  More...
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
new void DeleteLater ()
  More...
 
new bool Disconnect (QObject receiver, string member=null)
  More...
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
  More...
 
new void DumpObjectInfo ()
  More...
 
new void DumpObjectTree ()
  More...
 
virtual bool OnEvent (QEvent e)
  More...
 
virtual bool EventFilter (QObject watched, QEvent @event)
  More...
 
new bool Inherits (string classname)
  More...
 
new void InstallEventFilter (QObject filterObj)
  More...
 
new void KillTimer (int id)
  More...
 
new object Property (string name)
  More...
 
new void RemoveEventFilter (QObject obj)
  More...
 
new bool SetProperty (string name, object value)
  More...
 
new void SetUserData (uint id, QObjectUserData data)
 
new int StartTimer (int interval)
  More...
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 

Static Public Member Functions

static int Execute (string program)
  More...
 
static int Execute (string program, System.Collections.Generic.List< string > arguments)
  More...
 
static bool StartDetached (string program)
  More...
 
static bool StartDetached (string program, System.Collections.Generic.List< string > arguments)
  More...
 
static bool StartDetached (string program, System.Collections.Generic.List< string > arguments, string workingDirectory)
  More...
 
static bool StartDetached (string program, System.Collections.Generic.List< string > arguments, string workingDirectory, ref long pid)
  More...
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QIODevice
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
  More...
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
  More...
 
static string Tr (string s, string c=null)
  More...
 
static string Tr (string s, string c, int n)
  More...
 
static string TrUtf8 (string s, string c=null)
  More...
 
static string TrUtf8 (string s, string c, int n)
  More...
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Write (QDataStream stream, QPoint point)
  More...
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream stream, QLineF line)
  More...
 
static QDataStream Write (QDataStream stream, QPointF point)
  More...
 
static QDataStream Write (QDataStream @out, QChar chr)
  More...
 
static QDataStream Write (QDataStream @out, QByteArray ba)
  More...
 
static QDataStream Write (QDataStream stream, QEasingCurve easing)
  More...
 
static QDataStream Write (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Write (QDataStream @out, QDateTime dateTime)
  More...
 
static QDataStream Write (QDataStream @out, QUrl url)
  More...
 
static QDataStream Write (QDataStream @out, QTime time)
  More...
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream @out, QBitArray ba)
  More...
 
static QDataStream Write (QDataStream s, QUuid id)
  More...
 
static QDataStream Write (QDataStream stream, QLine line)
  More...
 
static QDataStream Write (QDataStream @out, QDate date)
  More...
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
  More...
 
static QDataStream Write (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Write (QDataStream stream, QSize size)
  More...
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
  More...
 
static QDataStream Read (QDataStream @in, QChar chr)
  More...
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream @in, QDate date)
  More...
 
static QDataStream Read (QDataStream @in, QUrl url)
  More...
 
static QDataStream Read (QDataStream s, QUuid id)
  More...
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream stream, QLineF line)
  More...
 
static QDataStream Read (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Read (QDataStream stream, QPointF point)
  More...
 
static QDataStream Read (QDataStream stream, QLine line)
  More...
 
static QDataStream Read (QDataStream @in, QBitArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSize size)
  More...
 
static QDataStream Read (QDataStream @in, QDateTime dateTime)
  More...
 
static QDataStream Read (QDataStream @in, QTime time)
  More...
 
static QDataStream Read (QDataStream stream, QPoint point)
  More...
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
  More...
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream @in, QByteArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
  More...
 
static double QAcos (double v)
  More...
 
static void QAddPostRoutine (System.Action ptr)
  More...
 
static double QAsin (double v)
  More...
 
static double QAtan (double v)
  More...
 
static double QAtan2 (double x, double y)
  More...
 
static void QBadAlloc ()
 
static int QCeil (double v)
  More...
 
static ushort QChecksum (string s, uint len)
  More...
 
static QByteArray QCompress (QByteArray data, int compressionLevel=-1)
  More...
 
static QByteArray QCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
  More...
 
static double QCos (double v)
  More...
 
static double QExp (double v)
  More...
 
static double QFabs (double v)
 
static double QFastCos (double x)
 
static double QFastSin (double x)
 
static string QFlagLocation (string method)
 
static int QFloor (double v)
  More...
 
static bool QFuzzyCompare (double p1, double p2)
  More...
 
static bool QFuzzyCompare (float p1, float p2)
  More...
 
static bool QFuzzyIsNull (double d)
 
static bool QFuzzyIsNull (float f)
 
static uint QHash (QBitArray key)
  More...
 
static uint QHash (QChar key)
  More...
 
static uint QHash (QStringRef key)
 
static uint QHash (QUrl url)
  More...
 
static uint QHash (QPersistentModelIndex index)
 
static uint QHash (QByteArray key)
  More...
 
static uint QHash (QModelIndex index)
 
static uint QHash (uint key)
  More...
 
static uint QHash (char key)
  More...
 
static uint QHash (byte key)
  More...
 
static uint QHash (short key)
  More...
 
static uint QHash (NativeLong key)
  More...
 
static uint QHash (ushort key)
  More...
 
static uint QHash (long key)
  More...
 
static uint QHash (ulong key)
  More...
 
static uint QHash (int key)
  More...
 
static uint QHash (string key)
  More...
 
static uint QHash (NativeULong key)
  More...
 
static Qt.ActionQtMsgTypeString QInstallMsgHandler (Qt.ActionQtMsgTypeString handler)
  More...
 
static int QIntCast (float f)
 
static int QIntCast (double f)
 
static bool QIsFinite (double d)
 
static bool QIsFinite (float f)
 
static bool QIsInf (float f)
 
static bool QIsInf (double d)
 
static bool QIsNaN (float f)
 
static bool QIsNaN (double d)
 
static bool QIsNull (float f)
 
static bool QIsNull (double d)
 
static double QLn (double v)
  More...
 
static double QPow (double x, double y)
  More...
 
static void QRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
  More...
 
static void QRemovePostRoutine (System.Action arg1)
 
static int QRound (double d)
  More...
 
static long QRound64 (double d)
  More...
 
static double QSin (double v)
  More...
 
static double QSqrt (double v)
  More...
 
static bool QStringComparisonHelper (QStringRef s1, string s2)
 
static double QTan (double v)
  More...
 
static QByteArray QUncompress (QByteArray data)
  More...
 
static QByteArray QUncompress (Pointer< byte > data, int nbytes)
  More...
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
  More...
 
static bool Qputenv (string varName, QByteArray value)
  More...
 
static void Qsrand (uint seed)
  More...
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
  More...
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
  More...
 
static Pointer< sbyte > Qstrdup (string src)
  More...
 
static int Qstricmp (string str1, string str2)
  More...
 
static uint Qstrlen (string str)
  More...
 
static int Qstrncmp (string str1, string str2, uint len)
  More...
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
  More...
 
static int Qstrnicmp (string str1, string str2, uint len)
  More...
 
static uint Qstrnlen (string str, uint maxlen)
  More...
 

Protected Member Functions

 QProcess (System.Type dummy)
 
new void OnError (QProcess.ProcessError error)
  More...
 
new void OnFinished (int exitCode)
  More...
 
new void OnFinished (int exitCode, QProcess.ExitStatus exitStatus)
  More...
 
override long ReadData (Pointer< sbyte > data, long maxlen)
  More...
 
new void OnReadyReadStandardError ()
  More...
 
new void OnReadyReadStandardOutput ()
  More...
 
new void SetProcessState (QProcess.ProcessState state)
  More...
 
virtual void SetupChildProcess ()
  More...
 
new void OnStarted ()
  More...
 
new void OnStateChanged (QProcess.ProcessState state)
  More...
 
override long WriteData (string data, long len)
  More...
 
- Protected Member Functions inherited from QtCore.QIODevice
 QIODevice (System.Type dummy)
 
new void OnAboutToClose ()
  More...
 
new void OnBytesWritten (long bytes)
  More...
 
new void OnReadChannelFinished ()
  More...
 
virtual long ReadLineData (Pointer< sbyte > data, long maxlen)
  More...
 
new void OnReadyRead ()
  More...
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent @event)
  More...
 
virtual void ConnectNotify (string signal)
  More...
 
virtual void OnCustomEvent (QEvent @event)
  More...
 
new void OnDestroyed (QObject obj=null)
  More...
 
virtual void DisconnectNotify (string signal)
  More...
 
new int Receivers (string signal)
  More...
 
virtual void OnTimerEvent (QTimerEvent @event)
  More...
 

Properties

Slot Started
  More...
 
Slot< System.Int32 > Finished
  More...
 
Slot< System.Int32,
QProcess.ExitStatus
FinishedExitStatus
  More...
 
Slot< QProcess.ProcessErrorErrorError
  More...
 
Slot< QProcess.ProcessStateStateChanged
  More...
 
Slot ReadyReadStandardOutput
  More...
 
Slot ReadyReadStandardError
  More...
 
System.Collections.Generic.List
< string > 
Environment [get, set]
  More...
 
string NativeArguments [get, set]
  More...
 
QProcess.ProcessChannelMode processChannelMode [get, set]
  More...
 
QProcessEnvironment ProcessEnvironment [get, set]
  More...
 
QProcess.ProcessChannel ReadChannel [get, set]
  More...
 
QProcess.ProcessChannelMode ReadChannelMode [get, set]
  More...
 
string WorkingDirectory [get, set]
  More...
 
override bool AtEnd [get]
  More...
 
override long BytesAvailable [get]
  More...
 
override long BytesToWrite [get]
  More...
 
override bool CanReadLine [get]
  More...
 
override bool IsSequential [get]
  More...
 
QProcess.ProcessState State [get]
  More...
 
static
System.Collections.Generic.List
< string > 
SystemEnvironment [get]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQProcessSignals Emit [get]
 
- Properties inherited from QtCore.QIODevice
Slot ReadyRead
  More...
 
Slot< System.Int64 > BytesWritten
  More...
 
Slot AboutToClose
  More...
 
Slot ReadChannelFinished
  More...
 
string ErrorString [get, set]
  More...
 
QIODevice.OpenModeFlag OpenMode [get, set]
  More...
 
virtual bool AtEnd [get]
  More...
 
virtual long BytesAvailable [get]
  More...
 
virtual long BytesToWrite [get]
  More...
 
virtual bool CanReadLine [get]
  More...
 
bool IsOpen [get]
  More...
 
bool IsReadable [get]
  More...
 
virtual bool IsSequential [get]
  More...
 
bool IsTextModeEnabled [get]
  More...
 
bool IsWritable [get]
  More...
 
virtual long Pos [get]
  More...
 
virtual long Size [get]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQIODeviceSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
  More...
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
  More...
 
Slot< QObjectDestroyedObj
  More...
 
Slot Destroyed
  More...
 
QObject Parent [get, set]
  More...
 
System.Collections.Generic.List
< QObject
Children [get]
  More...
 
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames [get]
  More...
 
bool IsWidgetType [get]
  More...
 
static uint RegisterUserData [get]
 
QObject Sender [get]
  More...
 
int SenderSignalIndex [get]
  More...
 
bool SignalsBlocked [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
  More...
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 
- Properties inherited from QtCore.Qt
static string QAppName [get]
 
static double QInf [get]
 
static double QQNaN [get]
 
static double QSNaN [get]
 
static bool QSharedBuild [get]
 
static string QVersion [get]
  More...
 
static int Qrand [get]
  More...
 

Additional Inherited Members

- Static Public Attributes inherited from QtCore.Qt
</para > *< para > Creating QM
files suitable for use with
this[SmokeMethod("qtTrId(const
char*, int)")] static strin 
QtTrId )(string id, int n=-1)
 
- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QProcess class is used to start external programs and to communicate with them.

Running a Process

To start a process, pass the name and command line arguments of the program you want to run as arguments to start(). Arguments are supplied as individual strings in a QStringList.

For example, the following code snippet runs the analog clock example in the Motif style on X11 platforms by passing strings containing "-style" and "motif" as two items in the list of arguments:

QObject *parent;

...

QString program = "./path/to/Qt/examples/widgets/analogclock";

QStringList arguments;

arguments << "-style" << "motif";

QProcess *myProcess = new QProcess(parent);

myProcess->start(program, arguments);

QProcess then enters the Starting state, and when the program has started, QProcess enters the Running state and emits started().

QProcess allows you to treat a process as a sequential I/O device. You can write to and read from the process just as you would access a network connection using QTcpSocket. You can then write to the process's standard input by calling write(), and read the standard output by calling read(), readLine(), and getChar(). Because it inherits QIODevice, QProcess can also be used as an input source for QXmlReader, or for generating data to be uploaded using QFtp.

Note: On Windows CE and Symbian, reading and writing to a process is not supported.

When the process exits, QProcess reenters the NotRunning state (the initial state), and emits finished().

The finished() signal provides the exit code and exit status of the process as arguments, and you can also call exitCode() to obtain the exit code of the last process that finished, and exitStatus() to obtain its exit status. If an error occurs at any point in time, QProcess will emit the error() signal. You can also call error() to find the type of error that occurred last, and state() to find the current process state.

Communicating via Channels

Processes have two predefined output channels: The standard output channel (stdout) supplies regular console output, and the standard error channel (stderr) usually supplies the errors that are printed by the process. These channels represent two separate streams of data. You can toggle between them by calling setReadChannel(). QProcess emits readyRead() when data is available on the current read channel. It also emits readyReadStandardOutput() when new standard output data is available, and when new standard error data is available, readyReadStandardError() is emitted. Instead of calling read(), readLine(), or getChar(), you can explicitly read all data from either of the two channels by calling readAllStandardOutput() or readAllStandardError().

The terminology for the channels can be misleading. Be aware that the process's output channels correspond to QProcess's read channels, whereas the process's input channels correspond to QProcess's write channels. This is because what we read using QProcess is the process's output, and what we write becomes the process's input.

QProcess can merge the two output channels, so that standard output and standard error data from the running process both use the standard output channel. Call setProcessChannelMode() with MergedChannels before starting the process to activative this feature. You also have the option of forwarding the output of the running process to the calling, main process, by passing ForwardedChannels as the argument.

Certain processes need special environment settings in order to operate. You can set environment variables for your process by calling setEnvironment(). To set a working directory, call setWorkingDirectory(). By default, processes are run in the current working directory of the calling process.

Note: On Symbian, setting environment or working directory is not supported. The working directory will always be the private directory of the running process.

Note: On QNX, setting the working directory may cause all application threads, with the exception of the QProcess caller thread, to temporarily freeze, owing to a limitation in the operating system.

Synchronous Process API

QProcess provides a set of functions which allow it to be used without an event loop, by suspending the calling thread until certain signals are emitted:

waitForStarted() blocks until the process has started.

waitForReadyRead() blocks until new data is available for reading on the current read channel.

waitForBytesWritten() blocks until one payload of data has been written to the process.

waitForFinished() blocks until the process has finished.

Calling these functions from the main thread (the thread that calls QApplication::exec()) may cause your user interface to freeze.

The following example runs gzip to compress the string "Qt rocks!", without an event loop:

QProcess gzip;

gzip.start("gzip", QStringList() << "-c");

if (!gzip.waitForStarted())

return false;

gzip.write("Qt rocks!");

gzip.closeWriteChannel();

if (!gzip.waitForFinished())

return false;

QByteArray result = gzip.readAll();

Notes for Windows Users

Some Windows commands (for example, dir) are not provided by separate applications, but by the command interpreter itself. If you attempt to use QProcess to execute these commands directly, it won't work. One possible solution is to execute the command interpreter itself (cmd.exe on some Windows systems), and ask the interpreter to execute the desired command.

Symbian Platform Security Requirements

On Symbian, processes which use the functions kill() or terminate() must have the PowerMgmt platform security capability. If the client process lacks this capability, these functions will fail.

Platform security capabilities are added via the TARGET.CAPABILITY qmake variable.

See also QBuffer, QFile, and QTcpSocket.

Member Enumeration Documentation

This enum describes the different exit statuses of QProcess.

See also exitStatus().

Enumerator
CrashExit 

The process crashed.

NormalExit 

The process exited normally.

This enum describes the process channels used by the running process. Pass one of these values to setReadChannel() to set the current read channel of QProcess.

See also setReadChannel().

Enumerator
StandardError 

The standard error (stderr) of the running process.

StandardOutput 

The standard output (stdout) of the running process.

This enum describes the process channel modes of QProcess. Pass one of these values to setProcessChannelMode() to set the current read channel mode.

See also setProcessChannelMode().

Enumerator
ForwardedChannels 

QProcess forwards the output of the running process onto the main process. Anything the child process writes to its standard output and standard error will be written to the standard output and standard error of the main process.

MergedChannels 

QProcess merges the output of the running process into the standard output channel (stdout). The standard error channel (stderr) will not receive any data. The standard output and standard error data of the running process are interleaved.

SeparateChannels 

QProcess manages the output of the running process, keeping standard output and standard error data in separate internal buffers. You can select the QProcess's current read channel by calling setReadChannel(). This is the default channel mode of QProcess.

This enum describes the different types of errors that are reported by QProcess.

See also error().

Enumerator
Crashed 

The process crashed some time after starting successfully.

FailedToStart 

The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.

ReadError 

An error occurred when attempting to read from the process. For example, the process may not be running.

Timedout 

The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.

UnknownError 

An unknown error occurred. This is the default return value of error().

WriteError 

An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.

This enum describes the different states of QProcess.

See also state().

Enumerator
NotRunning 

The process is not running.

Running 

The process is running and is ready for reading and writing.

Starting 

The process is starting, but the program has not yet been invoked.

Constructor & Destructor Documentation

QtCore.QProcess.QProcess ( System.Type  dummy)
protected
QtCore.QProcess.QProcess ( QObject  parent = null)

Constructs a QProcess object with the given parent.

Here is the call graph for this function:

Member Function Documentation

override void QtCore.QProcess.Close ( )
virtual

Reimplemented from QIODevice::close().

Closes all communication with the process and kills it. After calling this function, QProcess will no longer emit readyRead(), and data can no longer be read or written.

Reimplemented from QtCore.QIODevice.

new void QtCore.QProcess.CloseReadChannel ( QProcess.ProcessChannel  channel)

Closes the read channel channel. After calling this function, QProcess will no longer receive data on the channel. Any data that has already been received is still available for reading.

Call this function to save memory, if you are not interested in the output of the process.

See also closeWriteChannel() and setReadChannel().

new void QtCore.QProcess.CloseWriteChannel ( )

Schedules the write channel of QProcess to be closed. The channel will close once all data has been written to the process. After calling this function, any attempts to write to the process will fail.

Closing the write channel is necessary for programs that read input data until the channel has been closed. For example, the program "more" is used to display text data in a console on both Unix and Windows. But it will not display the text data until QProcess's write channel has been closed. Example:

QProcess more;

more.start("more");

more.write("Text to display");

more.closeWriteChannel();

// QProcess will emit readyRead() once "more" starts printing

The write channel is implicitly opened when start() is called.

See also closeReadChannel().

override void QtCore.QProcess.CreateProxy ( )
virtual

Reimplemented from QtCore.QIODevice.

Here is the caller graph for this function:

new void QtCore.QProcess.Dispose ( )
new QProcess.ProcessError QtCore.QProcess.Error ( )

Returns the type of error that occurred last.

See also state().

static int QtCore.QProcess.Execute ( string  program)
static

This is an overloaded function.

Starts the program program in a new process. program is a single string of text containing both the program name and its arguments. The arguments are separated by one or more spaces.

static int QtCore.QProcess.Execute ( string  program,
System.Collections.Generic.List< string >  arguments 
)
static

Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.

The environment and working directory are inherited from the calling process.

On Windows, arguments that contain spaces are wrapped in quotes.

If the process cannot be started, -2 is returned. If the process crashes, -1 is returned. Otherwise, the process' exit code is returned.

new int QtCore.QProcess.ExitCode ( )

Returns the exit code of the last process that finished.

new QProcess.ExitStatus QtCore.QProcess.exitStatus ( )

Returns the exit status of the last process that finished.

On Windows, if the process was terminated with TerminateProcess() from another application this function will still return NormalExit unless the exit code is less than 0.

This function was introduced in Qt 4.1.

Here is the caller graph for this function:

new void QtCore.QProcess.Kill ( )

Kills the current process, causing it to exit immediately.

On Windows, kill() uses TerminateProcess, and on Unix and Mac OS X, the SIGKILL signal is sent to the process.

On Symbian, this function requires platform security capability PowerMgmt. If absent, the process will panic with KERN-EXEC 46.

Note: Killing running processes from other processes will typically cause a panic in Symbian due to platform security.

See also Symbian Platform Security Requirements and terminate().

new void QtCore.QProcess.OnError ( QProcess.ProcessError  error)
protected

This signal is emitted when an error occurs with the process. The specified error describes the type of error that occurred.

new void QtCore.QProcess.OnFinished ( int  exitCode)
protected

This is an overloaded function.

Use finished(int exitCode, QProcess::ExitStatus status) instead.

new void QtCore.QProcess.OnFinished ( int  exitCode,
QProcess.ExitStatus  exitStatus 
)
protected

This signal is emitted when the process finishes. exitCode is the exit code of the process, and exitStatus is the exit status. After the process has finished, the buffers in QProcess are still intact. You can still read any data that the process may have written before it finished.

See also exitStatus().

Here is the call graph for this function:

new void QtCore.QProcess.OnReadyReadStandardError ( )
protected

This signal is emitted when the process has made new data available through its standard error channel (stderr). It is emitted regardless of the current read channel.

See also readAllStandardError() and readChannel().

new void QtCore.QProcess.OnReadyReadStandardOutput ( )
protected

This signal is emitted when the process has made new data available through its standard output channel (stdout). It is emitted regardless of the current read channel.

See also readAllStandardOutput() and readChannel().

new void QtCore.QProcess.OnStarted ( )
protected

This signal is emitted by QProcess when the process has started, and state() returns Running.

new void QtCore.QProcess.OnStateChanged ( QProcess.ProcessState  state)
protected

This signal is emitted whenever the state of QProcess changes. The newState argument is the state QProcess changed to.

new QByteArray QtCore.QProcess.ReadAllStandardError ( )

Regardless of the current read channel, this function returns all data available from the standard error of the process as a QByteArray.

See also readyReadStandardError(), readAllStandardOutput(), readChannel(), and setReadChannel().

new QByteArray QtCore.QProcess.ReadAllStandardOutput ( )

Regardless of the current read channel, this function returns all data available from the standard output of the process as a QByteArray.

See also readyReadStandardOutput(), readAllStandardError(), readChannel(), and setReadChannel().

override long QtCore.QProcess.ReadData ( Pointer< sbyte >  data,
long  maxlen 
)
protectedvirtual

Reimplemented from QIODevice::readData().

Implements QtCore.QIODevice.

new void QtCore.QProcess.SetProcessState ( QProcess.ProcessState  state)
protected

Sets the current state of the QProcess to the state specified.

See also state().

new void QtCore.QProcess.SetStandardErrorFile ( string  fileName,
QIODevice.OpenModeFlag  mode = QIODevice.OpenModeFlag.Truncate 
)

Redirects the process' standard error to the file fileName. When the redirection is in place, the standard error read channel is closed: reading from it using read() will always fail, as will readAllStandardError(). The file will be appended to if mode is Append, otherwise, it will be truncated.

See setStandardOutputFile() for more information on how the file is opened.

Note: if setProcessChannelMode() was called with an argument of QProcess::MergedChannels, this function has no effect.

This function was introduced in Qt 4.2.

See also setStandardInputFile(), setStandardOutputFile(), and setStandardOutputProcess().

new void QtCore.QProcess.SetStandardInputFile ( string  fileName)

Redirects the process' standard input to the file indicated by fileName. When an input redirection is in place, the QProcess object will be in read-only mode (calling write() will result in error).

If the file fileName does not exist at the moment start() is called or is not readable, starting the process will fail.

Calling setStandardInputFile() after the process has started has no effect.

This function was introduced in Qt 4.2.

See also setStandardOutputFile(), setStandardErrorFile(), and setStandardOutputProcess().

new void QtCore.QProcess.SetStandardOutputFile ( string  fileName,
QIODevice.OpenModeFlag  mode = QIODevice.OpenModeFlag.Truncate 
)

Redirects the process' standard output to the file fileName. When the redirection is in place, the standard output read channel is closed: reading from it using read() will always fail, as will readAllStandardOutput().

If the file fileName doesn't exist at the moment start() is called, it will be created. If it cannot be created, the starting will fail.

If the file exists and mode is QIODevice::Truncate, the file will be truncated. Otherwise (if mode is QIODevice::Append), the file will be appended to.

Calling setStandardOutputFile() after the process has started has no effect.

This function was introduced in Qt 4.2.

See also setStandardInputFile(), setStandardErrorFile(), and setStandardOutputProcess().

new void QtCore.QProcess.SetStandardOutputProcess ( QProcess  destination)

Pipes the standard output stream of this process to the destination process' standard input.

The following shell command:

command1 | command2

Can be accomplished with QProcesses with the following code:

QProcess process1;

QProcess process2;

process1.setStandardOutputProcess(&process2);

process1.start("command1");

process2.start("command2");

This function was introduced in Qt 4.2.

virtual void QtCore.QProcess.SetupChildProcess ( )
protectedvirtual

This function is called in the child process context just before the program is executed on Unix or Mac OS X (i.e., after fork(), but before execve()). Reimplement this function to do last minute initialization of the child process. Example:

class SandboxProcess : public QProcess

{

...

protected:

void setupChildProcess();

...

};

void SandboxProcess::setupChildProcess()

{

// Drop all privileges in the child process, and enter

// a chroot jail.

#if defined Q_OS_UNIX

::setgroups(0, 0);

::chroot("/etc/safe");

::chdir("/");

::setgid(safeGid);

::setuid(safeUid);

::umask(0);

#endif

}

You cannot exit the process (by calling exit(), for instance) from this function. If you need to stop the program before it starts execution, your workaround is to emit finished() and then call exit().

Warning: This function is called by QProcess on Unix and Mac OS X only. On Windows and QNX, it is not called.

new void QtCore.QProcess.Start ( string  program,
QIODevice.OpenModeFlag  mode = QIODevice.OpenModeFlag.ReadWrite 
)

This is an overloaded function.

Starts the program program in a new process, if one is not already running. program is a single string of text containing both the program name and its arguments. The arguments are separated by one or more spaces. For example:

QProcess process;

process.start("del /s *.txt");

// same as process.start("del", QStringList() << "/s" << "*.txt");

...

The program string can also contain quotes, to ensure that arguments containing spaces are correctly supplied to the new process. For example:

QProcess process;

process.start("dir \"My Documents\"");

If the QProcess object is already running a process, a warning may be printed at the console, and the existing process will continue running.

Note that, on Windows, quotes need to be both escaped and quoted. For example, the above code would be specified in the following way to ensure that "My Documents" is used as the argument to the dir executable:

QProcess process;

process.start("dir \"\"\"My Documents\"\"\"");

The OpenMode is set to mode.

new void QtCore.QProcess.Start ( string  program,
System.Collections.Generic.List< string >  arguments,
QIODevice.OpenModeFlag  mode = QIODevice.OpenModeFlag.ReadWrite 
)

Starts the given program in a new process, if none is already running, passing the command line arguments in arguments. The OpenMode is set to mode.

The QProcess object will immediately enter the Starting state. If the process starts successfully, QProcess will emit started(); otherwise, error() will be emitted. If the QProcess object is already running a process, a warning may be printed at the console, and the existing process will continue running.

Note: Processes are started asynchronously, which means the started() and error() signals may be delayed. Call waitForStarted() to make sure the process has started (or has failed to start) and those signals have been emitted.

Note: No further splitting of the arguments is performed.

Windows: Arguments that contain spaces are wrapped in quotes.

See also pid(), started(), and waitForStarted().

static bool QtCore.QProcess.StartDetached ( string  program)
static

This is an overloaded function.

Starts the program program in a new process. program is a single string of text containing both the program name and its arguments. The arguments are separated by one or more spaces.

The program string can also contain quotes, to ensure that arguments containing spaces are correctly supplied to the new process.

static bool QtCore.QProcess.StartDetached ( string  program,
System.Collections.Generic.List< string >  arguments 
)
static

Starts the program program with the given arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to live.

Note: Arguments that contain spaces are not passed to the process as separate arguments.

Unix: The started process will run in its own session and act like a daemon.

Windows: Arguments that contain spaces are wrapped in quotes. The started process will run as a regular standalone process.

static bool QtCore.QProcess.StartDetached ( string  program,
System.Collections.Generic.List< string >  arguments,
string  workingDirectory 
)
static

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to live.

Note that arguments that contain spaces are not passed to the process as separate arguments.

Unix: The started process will run in its own session and act like a daemon.

Windows: Arguments that contain spaces are wrapped in quotes. The started process will run as a regular standalone process.

The process will be started in the directory workingDirectory.

Note: On QNX, this may cause all application threads to temporarily freeze.

If the function is successful then *pid is set to the process identifier of the started process.

static bool QtCore.QProcess.StartDetached ( string  program,
System.Collections.Generic.List< string >  arguments,
string  workingDirectory,
ref long  pid 
)
static

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to live.

Note that arguments that contain spaces are not passed to the process as separate arguments.

Unix: The started process will run in its own session and act like a daemon.

Windows: Arguments that contain spaces are wrapped in quotes. The started process will run as a regular standalone process.

The process will be started in the directory workingDirectory.

Note: On QNX, this may cause all application threads to temporarily freeze.

If the function is successful then *pid is set to the process identifier of the started process.

new void QtCore.QProcess.Terminate ( )

Attempts to terminate the process.

The process may not exit as a result of calling this function (it is given the chance to prompt the user for any unsaved files, etc).

On Windows, terminate() posts a WM_CLOSE message to all toplevel windows of the process and then to the main thread of the process itself. On Unix and Mac OS X the SIGTERM signal is sent.

Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by calling kill().

On Symbian, this function requires platform security capability PowerMgmt. If absent, the process will panic with KERN-EXEC 46.

Note: Terminating running processes from other processes will typically cause a panic in Symbian due to platform security.

See also Symbian Platform Security Requirements and kill().

static string QtCore.QProcess.Tr ( string  s,
string  c = null 
)
static
static string QtCore.QProcess.Tr ( string  s,
string  c,
int  n 
)
static
static string QtCore.QProcess.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtCore.QProcess.TrUtf8 ( string  s,
string  c,
int  n 
)
static
override bool QtCore.QProcess.WaitForBytesWritten ( int  msecs = 30000)
virtual

Reimplemented from QIODevice::waitForBytesWritten().

Reimplemented from QtCore.QIODevice.

new bool QtCore.QProcess.WaitForFinished ( int  msecs = 30000)

Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process finished; otherwise returns false (if the operation timed out, if an error occurred, or if this QProcess is already finished).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

If msecs is -1, this function will not time out.

See also finished(), waitForStarted(), waitForReadyRead(), and waitForBytesWritten().

override bool QtCore.QProcess.WaitForReadyRead ( int  msecs = 30000)
virtual

Reimplemented from QIODevice::waitForReadyRead().

Reimplemented from QtCore.QIODevice.

new bool QtCore.QProcess.WaitForStarted ( int  msecs = 30000)

Blocks until the process has started and the started() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process was started successfully; otherwise returns false (if the operation timed out or if an error occurred).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning: Calling this function from the main (GUI) thread might cause your user interface to freeze.

If msecs is -1, this function will not time out.

See also started(), waitForReadyRead(), waitForBytesWritten(), and waitForFinished().

override long QtCore.QProcess.WriteData ( string  data,
long  len 
)
protectedvirtual

Reimplemented from QIODevice::writeData().

Implements QtCore.QIODevice.

Property Documentation

override bool QtCore.QProcess.AtEnd
get

Reimplemented from QIODevice::atEnd().

Returns true if the process is not running, and no more data is available for reading; otherwise returns false.

override long QtCore.QProcess.BytesAvailable
get

Reimplemented from QIODevice::bytesAvailable().

override long QtCore.QProcess.BytesToWrite
get

Reimplemented from QIODevice::bytesToWrite().

override bool QtCore.QProcess.CanReadLine
get

Reimplemented from QIODevice::canReadLine().

This function operates on the current read channel.

See also readChannel() and setReadChannel().

new IQProcessSignals QtCore.QProcess.Emit
getprotected
System.Collections.Generic.List<string> QtCore.QProcess.Environment
getset

This function is deprecated.

Returns the environment that QProcess will use when starting a process, or an empty QStringList if no environment has been set using setEnvironment() or setEnvironmentHash(). If no environment has been set, the environment of the calling process will be used.

Note: The environment settings are ignored on Windows CE and Symbian, as there is no concept of an environment.

This function is deprecated.

Sets the environment that QProcess will use when starting a process to the environment specified which consists of a list of key=value pairs.

For example, the following code adds the C:\\BIN directory to the list of executable paths (PATHS) on Windows:

QProcess process;

QStringList env = QProcess::systemEnvironment();

env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable

env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;C:\\Bin");

process.setEnvironment(env);

process.start("myapp");

Note: This function is less efficient than the setProcessEnvironment() function.

Slot<QProcess.ProcessError> QtCore.QProcess.ErrorError
addremove

This signal is emitted when an error occurs with the process. The specified error describes the type of error that occurred.

Slot<System.Int32> QtCore.QProcess.Finished
addremove

This is an overloaded function.

Use finished(int exitCode, QProcess::ExitStatus status) instead.

Slot<System.Int32,QProcess.ExitStatus> QtCore.QProcess.FinishedExitStatus
addremove

This signal is emitted when the process finishes. exitCode is the exit code of the process, and exitStatus is the exit status. After the process has finished, the buffers in QProcess are still intact. You can still read any data that the process may have written before it finished.

See also exitStatus().

override bool QtCore.QProcess.IsSequential
get

Reimplemented from QIODevice::isSequential().

string QtCore.QProcess.NativeArguments
getset

Returns the additional native command line arguments for the program.

Note: This function is available only on the Windows and Symbian platforms.

This function was introduced in Qt 4.7.

This is an overloaded function.

Sets additional native command line arguments for the program.

On operating systems where the system API for passing command line arguments to a subprocess natively uses a single string, one can conceive command lines which cannot be passed via QProcess's portable list-based API. In such cases this function must be used to set a string which is appended to the string composed from the usual argument list, with a delimiting space.

Note: This function is available only on the Windows and Symbian platforms.

This function was introduced in Qt 4.7.

QProcess.ProcessChannelMode QtCore.QProcess.processChannelMode
getset

Returns the channel mode of the QProcess standard output and standard error channels.

This function was introduced in Qt 4.2.

Sets the channel mode of the QProcess standard output and standard error channels to the mode specified. This mode will be used the next time start() is called. For example:

QProcess builder;

builder.setProcessChannelMode(QProcess::MergedChannels);

builder.start("make", QStringList() << "-j2");

if (!builder.waitForFinished())

qDebug() << "Make failed:" << builder.errorString();

else

qDebug() << "Make output:" << builder.readAll();

This function was introduced in Qt 4.2.

QProcessEnvironment QtCore.QProcess.ProcessEnvironment
getset

Returns the environment that QProcess will use when starting a process, or an empty object if no environment has been set using setEnvironment() or setProcessEnvironment(). If no environment has been set, the environment of the calling process will be used.

Note: The environment settings are ignored on Windows CE, as there is no concept of an environment.

This function was introduced in Qt 4.6.

Sets the environment that QProcess will use when starting a process to the environment object.

For example, the following code adds the C:\\BIN directory to the list of executable paths (PATHS) on Windows and sets TMPDIR:

QProcess process;

QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

env.insert("TMPDIR", "C:\\MyApp\\temp"); // Add an environment variable

env.insert("PATH", env.value("Path") + ";C:\\Bin");

process.setProcessEnvironment(env);

process.start("myapp");

Note how, on Windows, environment variable names are case-insensitive.

This function was introduced in Qt 4.6.

QProcess.ProcessChannel QtCore.QProcess.ReadChannel
getset

Returns the current read channel of the QProcess.

Sets the current read channel of the QProcess to the given channel. The current input channel is used by the functions read(), readAll(), readLine(), and getChar(). It also determines which channel triggers QProcess to emit readyRead().

QProcess.ProcessChannelMode QtCore.QProcess.ReadChannelMode
getset

Returns the read channel mode of the QProcess. This function is equivalent to processChannelMode()

Use setProcessChannelMode(mode) instead.

Slot QtCore.QProcess.ReadyReadStandardError
addremove

This signal is emitted when the process has made new data available through its standard error channel (stderr). It is emitted regardless of the current read channel.

See also readAllStandardError() and readChannel().

Slot QtCore.QProcess.ReadyReadStandardOutput
addremove

This signal is emitted when the process has made new data available through its standard output channel (stdout). It is emitted regardless of the current read channel.

See also readAllStandardOutput() and readChannel().

Slot QtCore.QProcess.Started
addremove

This signal is emitted by QProcess when the process has started, and state() returns Running.

QProcess.ProcessState QtCore.QProcess.State
get

Returns the current state of the process.

See also stateChanged() and error().

Slot<QProcess.ProcessState> QtCore.QProcess.StateChanged
addremove

This signal is emitted whenever the state of QProcess changes. The newState argument is the state QProcess changed to.

new QMetaObject QtCore.QProcess.StaticMetaObject
staticget
System.Collections.Generic.List<string> QtCore.QProcess.SystemEnvironment
staticget

Returns the environment of the calling process as a list of key=value pairs. Example:

QStringList environment = QProcess::systemEnvironment();

// environment = {"PATH=/usr/bin:/usr/local/bin",

// "USER=greg", "HOME=/home/greg"}

This function does not cache the system environment. Therefore, it's possible to obtain an updated version of the environment if low-level C library functions like setenv ot putenv have been called.

However, note that repeated calls to this function will recreate the list of environment variables, which is a non-trivial operation.

Note: For new code, it is recommended to use QProcessEnvironment::systemEnvironment()

This function was introduced in Qt 4.1.

See also QProcessEnvironment::systemEnvironment(), environment(), and setEnvironment().

string QtCore.QProcess.WorkingDirectory
getset

If QProcess has been assigned a working directory, this function returns the working directory that the QProcess will enter before the program has started. Otherwise, (i.e., no directory has been assigned,) an empty string is returned, and QProcess will use the application's current working directory instead.

Sets the working directory to dir. QProcess will start the process in this directory. The default behavior is to start the process in the working directory of the calling process.

Note: The working directory setting is ignored on Symbian; the private directory of the process is considered its working directory.

Note: On QNX, this may cause all application threads to temporarily freeze.