进程管理,操作系统的进程管理与操作
execute(bin_path, parameters) {#execute}
运行指定的可执行文件
参数
类型
说明
bin_path
string
执行文件名
parameters
string
命令行参数,可忽略。
await __A . process . execute ( 'notepad' ) ;
await __A . process . execute ( 'notepad' , '/aaa.txt' ) ;
executeWait(bin_path, parameters) {#executeWait}
运行指定的可执行文件,并等待其运行完毕。 运行完毕后,返回运行结果信息。
参数
类型
说明
bin_path
string
执行文件名
parameters
string
命令行参数,可忽略。
返回值
说明
object
一个字典对象,其中:
retcode (number) 进程返回值
stdout (string) 标准输出
stderr (string) 标准错误
await __A . process . executeWait ( 'notepad' ) ;
await __A . process . executeWait ( 'notepad' , '/aaa.txt' ) ;
列出操作系统中的所有进程号。
返回值
说明
array
以操作系统进程号为元素的数组
await __A . process . list ( ) ;
检查指定进程号的进程是否存在
await __A . process . exists ( 0 ) ;
getInformation(pid) {#getInformation}
获得指定进程的详细信息
await __A . process . getInformation ( 999 ) ;
send_signal(pid, signal) {#send_signal}
向进程传递信号
参数
类型
说明
pid
int
进程号
signal
int
信号编码
await __A . process . send_signal ( 999 ,999 ) ;
挂起(暂停运行)指定的进程
await __A . process . suspend ( 999 ) ;
恢复(继续运行)指定的进程
await __A . process . resume ( 999 ) ;
停止指定的进程
await __A . process . kill ( 999 ) ;
terminate(pid) {#terminate}
终止指定的进程
await __A . process . terminate ( 999 ) ;