5

I have GTA San Andreas running in Wine, although when I exit the game it hangs in the terminal, and the process still has leftover resources, which causes it not to exit. So I've made this command which I think will loop over the lines in the output of the game and kill it when it finds leftover resources:

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'

And I've got this output from gta_sa.exe before it hangs:

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).

However, it doesn't work, and the process still hangs. Why won't this command work?

Please note: this is not a question about Wine, it is about the script I made.

  • 1
    It might as well be about wine, because the problem of system not being able to kill the processes, is because of wine not releasing the resources or not releasing them properly. Your script has nothing to do with the fixme messages. – MelBurslan Jun 16 '16 at 17:56
  • I know. I've researched this problem multiple times, tried different versions of Wine, and it still happens. Now i'm trying to work with it and make this solution. – jadenPete Jun 16 '16 at 17:57
  • 6
    Just a guess - wine doesn't print on stdout but on stderr. Try to put 2>&1 after wine command. – jimmij Jun 16 '16 at 17:58
11

From the character of the wine's output I conclude that it is some kind of error message, therefore probably is redirected to stderr, not stdout. In that case pipe doesn't transmit the message and next command (while) has nothing on its input. To overcome the problem you need to e.g. redirect wine's stderr to stdout by adding 2>&1 in front of the pipe |.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.