go-task / task

A task runner / simpler Make alternative written in Go
https://taskfile.dev
MIT License
11.01k stars 584 forks source link

Redirect is messing up order #807

Closed sandboxcom closed 2 years ago

sandboxcom commented 2 years ago

Example Taskfile showing the issue

---
version: '3'

tasks:
  present:
    vars:
      ANSWER:
        sh: whiptail --menu "Comes first:" 7 40 1 "I'm first " "I'm first" 3>&1 1>&2 2>&3
    cmds:
      - echo "And I shouldn't be last"
      - echo "pre {{.ANSWER}} post"
      - echo "But I'm last"
    silent: true
sandboxcom commented 2 years ago

In the end, I just want a menu system that works here. So if someone has a working solution with dialog or anything else, that's fine for me. I'm not sure about how to handle the bug - it obviously has something to do with the redirects, but then what's the menu solution?

andreynering commented 2 years ago

Hi @sandboxcom,

I'm sorry, but you're not supposed to call interactive apps inside a dynamic variable.

You can try moving the whiptail call to inside a multiline command somehow, but I haven't tried it.