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

expanding of home dir (~) is not working #74

Closed
i4o opened this issue Oct 15, 2017 · 7 comments
Closed

expanding of home dir (~) is not working #74

i4o opened this issue Oct 15, 2017 · 7 comments

Comments

@i4o
Copy link

i4o commented Oct 15, 2017

Simple task like hugo should generate site. It clearly takes bit longer in my case and 2nd following task cannot sync, as directory ~/myblog/site is not yet created.
Is there a way for 2nd task to wait for 1st task to finish?

But maybe there is issue with longer running tasks, as alone task gen doesn't seen to work properly, it never finishes.

Taskfile.yml

gen:
desc: hugo generate site
dir: ~/myblog
cmds:
- hugo

upload:
desc: rsync to server
cmds:
- rsync -avz --delete ~/myblog/site/* blog.xxx.net:/srv/blog.xxx.net/

default:
cmds:
- task: gen
- task: upload

i tried this first, didn't work either

default:
deps: [gen, upload]

@andreynering
Copy link
Member

Your first example is correct, the second task should wait for the first one to complete.

Hard to say with the given information why the second didn't run. Maybe the first error or hang?

I'm closing this since questions are supposed to be asked in the chat room.

@i4o
Copy link
Author

i4o commented Oct 15, 2017

In my original description I stated first task run, it just takes time for 1st task to finish. 2nd task never waited long enough. I assume you are running go routines with short timeout? I was trying to migrate from fabric to task, no issues to run the same command via fabric task.
Slightly confusing is also that task won't let you know about stdout of subtasks, so I don't know, what's going on.

@andreynering
Copy link
Member

@i4o Can you please give more information?

  • OS
  • Task version
  • Output while running default

Just to make it clear: the below will run serially:

default:
  cmds:
    - task: gen
    - task: upload

The below concurrently, so it's not what you want in this case:

default:
  deps: [gen, upload]

I assume you are running go routines with short timeout?

There's no timeout for running commands. It returns when the command finishes or error.

I was trying to migrate from fabric to task, no issues to run the same command via fabric task.

I don't know what Fabric is. Can you link it and (if relevant) paste configuration?

Slightly confusing is also that task won't let you know about stdout of subtasks, so I don't know, what's going on.

Stdout and stderr of commands are redirected while running it. Did you try to run these commands directly on console?

@andreynering andreynering reopened this Oct 15, 2017
@andreynering andreynering added the type: question Further information is requested. label Oct 15, 2017
@i4o
Copy link
Author

i4o commented Oct 15, 2017

I guess I found out how to make it run. My shell is fish[1]. When I switched to bash and run task I did get expected output. Sorry, it didn't occur to me it's shell agnostic. Reading your help even suggested task is using github.com/mvdan/sh. Maybe it's bug in mvdan/sh.

[1] ... https://fishshell.com/

Regarding version, I did go get on Friday. I would expect it to be reasonably current, unless your pace is hectic :).

$task  --version                                                                                    
Task version: master

I'm running Ubuntu 16.04.3 LTS

$ uname -a
Linux ico-ThinkPad-X230 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Did you try to run these commands directly on console?

Ofcourse I did. hugo command just takes a while to respond. There is no output initially for maybe 2-3 secs. Next run is about 400 ms, it's probably building some kind of cache.
fabric[2] is task runner in python. Not really relevant, but it's doing the same, running task one after another.
[2] ... http://www.fabfile.org/

What's important, when i1st task finishes it creates site directory, where are generated html files.

Error I was seeing is non-existent site directory, while running 2nd task. It appears not to be waiting long enough.

But now I'm trying to run single task gen, I don't get that site dir. It won't finish.
Actually it returns immediatelly, it puts out hugo and that's it.

[hugo] ... gohugo.io ( static site generator in golang )

@andreynering
Copy link
Member

@i4o Did you find to solve the issue?

I think there's a chance that the dir (~/myblog) is causing the issue. Can you try moving the Taskfile to the myblog directory, commenting dir: ~myblog and running it?

@i4o
Copy link
Author

i4o commented Oct 16, 2017

I think there's a chance that the dir (~/myblog) is causing the issue

You are correct.

I was running task from ~/myblog directory anyway, but was planning to move Taskfile.yml elsewhere, so I put there dir.
When I removed dir directive it was running as expected.

I tried then to move Taskfile.yml elsewhere, just to change ~ for full path in dir: /home/user/myblog and it still worked. Clearly I have to be carefull with dir.

Thank you for your help.

@i4o i4o closed this as completed Oct 16, 2017
@andreynering andreynering changed the title need to run tasks in serial expanding of home dir (~) is not working Nov 2, 2017
andreynering added a commit that referenced this issue Nov 2, 2017
@andreynering
Copy link
Member

Expanding of home dir has being fixed at master: baac067

andreynering added a commit that referenced this issue Jun 16, 2018
So a path like this works: $GOPATH/src/github.com/go-task/task

Allowing of "~" was also implemented. See #74 and baac067

Fixes #116
@pd93 pd93 removed the type: question Further information is requested. label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants