Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task fails when using "time" in the cmd #67

Closed
SethCurry opened this issue Sep 6, 2017 · 3 comments
Closed

Task fails when using "time" in the cmd #67

SethCurry opened this issue Sep 6, 2017 · 3 comments
Labels
dep: mvdan/sh Issues related to the upstream interpreter used by Task. type: bug Something not working as intended.

Comments

@SethCurry
Copy link

I have a Taskfile that's failing to run, despite that it most likely should. It looks like this:

build: cmds: - time go build -i

Which causes it to throw this error:

task: Failed to run task "build": 1:1: unhandled command node: *syntax.TimeClause

It looks like mvdan/sh is intercepting "time", assuming it's the shell keyword, and expecting something to happen with that.

A short workaround if anyone else needs it is to change time go build -i to $(which time) go build -i. It will change you from using the shell keyword time to the system's time binary, which is much uglier, but it gets the job done.

@smyrman smyrman added the type: bug Something not working as intended. label Sep 7, 2017
@andreynering
Copy link
Member

/cc @mvdan

@mvdan
Copy link

mvdan commented Sep 7, 2017

Yes - in Bash, time is a builtin and parses differently. For example, time foo | bar times all of foo | bar, while /bin/time foo | bar times just foo.

It's an unfortunate regression because earlier versions of the parser didn't do this correctly, so the interpreter just executed the system's time. Now we should add support for the keyword in the interpreter.

Another, easier workaround is to do "time" go build ..., as quoting the string means it can't be a keyword.

@andreynering
Copy link
Member

FIxed on master and new release by updating the upstream library.

Thanks @mvdan

@andreynering andreynering added the dep: mvdan/sh Issues related to the upstream interpreter used by Task. label Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dep: mvdan/sh Issues related to the upstream interpreter used by Task. type: bug Something not working as intended.
Projects
None yet
Development

No branches or pull requests

4 participants