process
进程操作静态类
引用:require("fastweb.process")
方法概览
| 返回值 | 方法及描述 |
|---|---|
number |
create(filepath,work_directory,args,wait_close,show_window)创建进程 |
void |
destory(pid)销毁进程 |
table |
list()系统进程列表 |
table |
exist(filepath)指定路径进程列表 |
bool |
exist_pid(pid)PID进程是否存在 |
string |
getpath(pid)取PID进程路径 |
方法详细
create(filepath,work_directory,args,wait_close,show_window)
| 描述 | 创建进程。 |
| 参数 | filepath (string): 可执行文件路径。 |
work_directory (string): 工作目录。 |
|
args (table): 参数。 |
|
wait_close (bool): 是否等待关闭。 |
|
show_window (bool): 显示默认窗口。 |
|
| 返回值 | number: 成功返回PID,失败返回0。 |
示例:
process.create("D:/1.exe","D:",{"-m","22"},false,true)
destory(pid)
| 描述 | 销毁指定进程。 |
| 参数 | pid (number): PID。 |
| 返回值 | bool: 是否成功。 |
list()
| 描述 | 获取系统当前进程列表。 |
| 参数 | 无 。 |
| 返回值 | table: 进程数组。 |
exist(filepath)
| 描述 | 指定路径进程PID列表。 |
| 参数 | filepath(string)进程路径。 |
| 返回值 | table: PID数组。 |
exist_pid(pid)
| 描述 | PID进程是否存在。 |
| 参数 | pid(number) 进程PID。 |
| 返回值 | bool: 是否存在。 |
getpath(pid)
| 描述 | 取PID进程路径。 |
| 参数 | pid(number) 进程PID。 |
| 返回值 | string: 进程路径。 |