termux / termux-widget

Termux add-on app which adds shortcuts to commands on the home screen.
https://f-droid.org/en/packages/com.termux.widget
Other
994 stars 116 forks source link

Termux script shortcut triggers device hang #67

Closed Minabsapi closed 2 years ago

Minabsapi commented 2 years ago

Problem description

Upon launching a script through the Termux:Widget module, the script fails and the device starts hanging, apparently due to a memory leak That script when launched directly through Termux doesn't trigger any issue

Steps to reproduce

  1. Create this script in Termux 's ".shortcuts" folder

Toggle ADB

getprop init.svc.adbd | grep "running" && (sudo stop adbd) || (sudo start adbd)

Its effect is to toggle device's ADB Daemon on / off according to its state.

  1. Start it from Termux (not shortcut) to see for yourself this works as intended (if rooted).

  2. Create a new shortcut targeting it

Expected behavior

Should work as it would when launched directly through the Termux app

Actual behavior

stop will fail, and the device will start to hang a few seconds after

Screenshot

Additional information

agnostic-apollo commented 2 years ago

Working fine for me. Are you using sudo from tsu package? If yes, then remove it with apt remove tsu and try latest version of this sudo instead and check if it works.

Seems like some environmental issue.

https://github.com/termux/termux-widget#termux-environment

Minabsapi commented 2 years ago

I was indeed using sudo from the tsu package. Removed and replaced it with your version, everything works correctly now. Thank you!

agnostic-apollo commented 2 years ago

Great, welcome.

tsu maintainers (@cswl) should look into this though. Possibly an issue should be opened in the repo.

https://github.com/cswl/tsu

Minabsapi commented 2 years ago

That's right, I will report that there