Ceci est une ancienne révision du document !
Table des matières
ProcessHandle [En cours de Traduction Wismerheal][WSL]
Cet objet représente un processus en cours d’exécution.
Fonctions
ProcessHandle
Fonction de Construction.
Syntaxe
var myObject = new ProcessHandle();
var myObject = new ProcessHandle(otherProcessHandle);
var myObject = new ProcessHandle(processId);
Arguments
- otherProcessHandle - (ProcessHandle) autre "ProcessHandle" à copier
- processId - (entier) identifiant de processus pour gérer/contrôler celui-ci
Exceptions
- (ParameterTypeError) type de paramètre incorrect
- (ParameterCountError) nombre de paramètre incorrect
Example
Créer un "ProcessHandle" représentant un processus invalide.
var myObject = new ProcessHandle();
Créer un "ProcessHandle" représentant une copie d' otherProcessHandle.
var myObject = new ProcessHandle(otherProcessHandle);
Créer un "ProcessHandleé lié au processus disposant de l'identifiant (id) 1337.
var myObject = new ProcessHandle(1337);
Méthodes
clone
Renvoi une copie de ce "ProcessHandle".
Syntax
myObject.clone();
Returns
- (ProcessHandle) une copie de ce "ProcessHandle"
Example
var copyOfMyObject = myObject.clone();
equals
Renvoi vrai si ce "ProcessHandle" et un autre se réfèrent au même processus.
Syntax
myObject.equals(other);
Arguments
- other - (ProcessHandle) autre "ProcessHandle"
Returns
- (bool) vrai si other se réfère au même processus
Example
if(myFirstObject.equals(mySecondObject)) //Do something
toString
Returns a string representing this ProcessHandle.
Syntax
myObject.toString();
Returns
- (string) a string representing this ProcessHandle
Example
Console.print(myObject.toString());
Notes
This method is automatically called when trying to convert a ProcessHandle to a string.
id
Returns the process id.
Syntax
myObject.id();
Returns
- (integer) the process id
kill
Try to kill the process.
Syntax
myObject.kill(killMode, timeout);
Arguments
- killMode - (KillMode) the kill mode to use
- timeout - (integer) the timeout in milliseconds to wait when using GracefulThenForceful
Returns
- (boolean) true if the process was killed
isRunning
Returns true if the process is currently running.
Syntax
myObject.isRunning();
Returns
- (boolean) true if the process is currently running
command
Returns the command that was used to start this process.
Syntax
myObject.command();
Returns
- (string) the command that was used to start this process
Exceptions
- (OpenProcessError) unable to open the process (Windows)
- (GetModuleFilenameError) unable to get the module filename (Windows)
- (GetProcessError) unable to get the process command (Linux)
priority
Returns the priority of this process.
Syntax
myObject.priority();
Returns
- (Priority) the process priority
Exceptions
- (OpenProcessError) unable to open the process (Windows)
- (GetPriorityClassError) unable to get priority class (Windows)
- (OperatingSystemError) this is not available on this operating system (Linux)
Notes
This method only works on Windows, because Linux doesn't have any concept of process priority.
Enumerations
KillMode
Policy to use when trying to kill a process.
Values
- Graceful: Linux: send a SIGTERM signal Windows: close all windows owned by this process
- Forceful: Linux: send a SIGKILL signal Windows: use TerminateProcess to kill this process
- GracefulThenForceful: try to kill the process using the graceful technique, wait for timeout and kill it using the forceful technique
Priority
A process priority.
Values
- AboveNormal: above normal
- BelowNormal: below normal
- High: high
- Idle: idle
- Normal: normal
- Realtime: realtime