cryinkfly / Autodesk-Fusion-360-for-Linux

This is a project, where I give you a way to use Autodesk Fusion 360 on Linux!
https://github.com/cryinkfly/Fusion-360---Linux-Wine-Version-/wiki
MIT License
1.95k stars 121 forks source link

Instead of randomly killing processes, use command `timeout` *solved* #257

Closed mikkorantalainen closed 2 years ago

mikkorantalainen commented 2 years ago

The script launches wineprocesses and then proceeds to kill them using a regex later. For example:

https://github.com/cryinkfly/Autodesk-Fusion-360-for-Linux/blob/d655d4b88ed0acb8a1bffa95ac07b55af29fc9f3/files/builds/stable-branch/bin/install.sh#L379

Instead of doing hacks like this, how about using command timeout instead?

If you executed the original wine command as

WINEPREFIX=.... timeout -k 10m 9m wine ...

would send SIGTERM to the wine process after 9 minutes and SIGKILL after 10 minutes if the process is still running. See man timeout for details.

cryinkfly commented 2 years ago

Okay, I got it and took a look. :+1:

WINEPREFIX=$HOME/.fusion360 timeout -k 2m 1m winecfg

and then I checked the value with:

echo $?

Then I got the exit code 124. This value is the timeout used to indicate the program has terminated using SIGTERM. When SIGKILL terminates the program, the exit code is 137.