使用 self.assert_process_status(True, "dde-control-center") 断言 dde-control-center 进程是否存在时,如果用户名在 GREP_LIST 中,如 youqu-user, get_process_status 无法返回正确的值,只能返回 False。
建议以 uid 的形式显示用户,或者不打印用户名。
$ id
uid=1000(youqu-user) gid=1000(youqu-user) groups=1000(youqu-user),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$ ps -aux | grep dde-control-center | grep -v grep | grep -v pytest | grep -v python | grep -v asan | grep -v tee | grep -v ffmpeg | grep -v youqu
$ ps -aunx | grep dde-control-center | grep -v grep | grep -v pytest | grep -v python | grep -v asan | grep -v tee | grep -v ffmpeg | grep -v youqu
1000 34298 0.1 12.7 971036 190536 ? Sl 18:25 0:00 dde-control-center --show
$ ps -ax | grep dde-control-center | grep -v grep | grep -v pytest | grep -v python | grep -v asan | grep -v tee | grep -v ffmpeg | grep -v youqu
34298 ? Sl 0:00 dde-control-center --show
使用
self.assert_process_status(True, "dde-control-center")断言 dde-control-center 进程是否存在时,如果用户名在 GREP_LIST 中,如 youqu-user, get_process_status 无法返回正确的值,只能返回 False。建议以 uid 的形式显示用户,或者不打印用户名。