这是indexloc提供的服务,不要输入任何密码
Skip to content

Termux:Task action executed asynchronously (i.e. doesn't make Tasker wait for it to finish) #16

@ks9208661

Description

@ks9208661

I created a shell script in Termux that has the command "sleep 10" inside, and placed this in the ~/.termux/tasker directory. In Tasker, I created a Task with 2 actions. The first one is Termux:Task that executes the shell script. The second is a Flash action that simply pops up a window with an "Awake" message.

When I run the task, the second action immediately gets executed, without waiting for the first to finish.

I'm not sure if Termux:Task is meant to execute asynchronously or synchronously, i.e. whether this is a feature or a bug. I saw this Tasker guide on how to create plugins, and tried to read the source code to find out whether the synchronous settings are there or not. Unfortunately, things went way over my head very quickly, so I decided to open this issue instead.

I currently have a way around this asynchronous behaviour. In Tasker, I add an action right after the Termux:Task action that will make Tasker wait until a Tasker variable is set, before proceeding to the next action. Then on the Termux script level, I add a line at the end of my script which sets this Tasker variable using the technique I learned from glow's blog. It's a bit kludgy though, and I would rather do things natively in Termux, if I could only make Termux behave synchronously.

For all I know, asynchronicity is what other users want. I myself can imagine scenarios where that could be handy. Perhaps it would be nice to have a way, for example via a termux.properties global setting or a checkbox within the Termux:Task action, where the user can set whether Termux:Task should make Tasker wait for it to finish or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions