我在 Wine 中运行 GTA San Andreas,尽管当我退出游戏时它挂在终端中,并且该进程仍有剩余资源,这导致它无法退出。所以我做了这个命令,我认为它会遍历游戏输出中的行并在找到剩余资源时杀死它:
bash -c 'cd /opt/GTA/San-Andreas && wine ./gta_sa.exe | while read line; do if [[ $(echo $line | grep -i "leftover resource") ]]; then killall gta_sa.exe; exit; fi; done'
Run Code Online (Sandbox Code Playgroud)
我在 gta_sa.exe 挂起之前得到了这个输出:
fixme:d3d:wined3d_device_uninit_3d Something's still holding the implicit swapchain.
fixme:d3d:wined3d_device_decref Device released with resources still bound, acceptable but unexpected.
fixme:d3d:wined3d_device_decref Leftover resource 0x539a5e8 with type WINED3D_RTYPE_TEXTURE_2D (0x2).
fixme:d3d:wined3d_device_decref Leftover resource 0x1b8ea8 with type WINED3D_RTYPE_TEXTURE_2D (0x2).
fixme:d3d:wined3d_device_decref Leftover resource 0x1b8cb0 with type WINED3D_RTYPE_TEXTURE_2D (0x2).
fixme:d3d:wined3d_device_decref Leftover resource 0x1b74b8 with type WINED3D_RTYPE_TEXTURE_2D (0x2).
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用,并且该过程仍然挂起。为什么这个命令不起作用?
请注意:这不是关于 Wine 的问题,而是关于我制作的脚本。
jim*_*mij 11
从wine
输出的字符我得出结论,它是某种错误消息,因此可能被重定向到 stderr,而不是 stdout。在这种情况下,管道不会传输消息,并且下一个命令 ( while
) 的输入没有任何内容。为了克服这个问题,您需要例如wine
通过2>&1
在管道前面添加来将stderr 的 stderr重定向到 stdout |
。
归档时间: |
|
查看次数: |
988 次 |
最近记录: |