Popen 不等待 Sandboxie 完成
Popen does not wait for Sandboxie to finish
我在使用 Python 的 subprocess.Popen
到 运行 一些可执行文件 ("a.exe
") 生成图像文件时遇到了一个有趣的问题,wait()
使用 shell=False
,然后我将使用 os.path.getsize
.
检查此图像文件的文件大小
当我使用Popen直接调用a.exe
时,文件就生成了,我可以成功获取图像文件的大小。
然而,由于我担心这一代人的安全,现在我将 Popen 与 Sandboxie 一起使用,后者又 运行 a.exe
在沙箱中。我遇到的问题是,当我尝试使用 getsize()
时,据说该文件不存在。但是,图像文件已生成,也许只是不在调用 getsize()
的时间点。
Popen 总是 wait()
让 Sandboxie 完成吗?从文档来看,似乎是这样,但实际上并非如此。我如何确保我的代码在继续之前等待 Sandboxie 完成?
http://www.sandboxie.com/?StartCommandLine
你想要/wait
The parameter /wait can be used to run a program, wait for it to finish, and return the exit status from the program:
"C:\Program Files\Sandboxie\Start.exe" /wait cmd.exe
我在使用 Python 的 subprocess.Popen
到 运行 一些可执行文件 ("a.exe
") 生成图像文件时遇到了一个有趣的问题,wait()
使用 shell=False
,然后我将使用 os.path.getsize
.
当我使用Popen直接调用a.exe
时,文件就生成了,我可以成功获取图像文件的大小。
然而,由于我担心这一代人的安全,现在我将 Popen 与 Sandboxie 一起使用,后者又 运行 a.exe
在沙箱中。我遇到的问题是,当我尝试使用 getsize()
时,据说该文件不存在。但是,图像文件已生成,也许只是不在调用 getsize()
的时间点。
Popen 总是 wait()
让 Sandboxie 完成吗?从文档来看,似乎是这样,但实际上并非如此。我如何确保我的代码在继续之前等待 Sandboxie 完成?
http://www.sandboxie.com/?StartCommandLine
你想要/wait
The parameter /wait can be used to run a program, wait for it to finish, and return the exit status from the program:
"C:\Program Files\Sandboxie\Start.exe" /wait cmd.exe