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

Duplication of files (in wrong dirs) when doing multiple dir copies #310

Open
tmarshall opened this issue Apr 24, 2018 · 3 comments
Open

Comments

@tmarshall
Copy link

tmarshall commented Apr 24, 2018

I have a taskfile that has a portion like this:

module.exports.copyProcs = async function copyProcs(task) {
  await task.source('procs/**/*.js').target('dist/procs')
  await task.source('procs/**/.*').target('dist/procs')
}

module.exports.copyConf = async function copyConf(task) {
  await task.source('conf/**/.*').target('dist/conf')
}

module.exports.copyDirs = async function copyDirs(task) {
  await task.parallel(['copyProcs', 'copyConf'])
}

module.exports.build = async function build(task) {
  // compile is not necessary to show
  await task.serial(['compile', 'copyDirs'])
} 

taskr build is my yarn build

This should copy all .js files and . files (specifically .gitignore) from procs to dist/procs

It should also copy all . files (specifically .eslintrc and .jscsrc) from conf to dist/conf

When run, it is copying .eslintrc and .jscsrc to both dist/conf and dist/procs.

If I change the content of function copyDirs to await task.serial(['copyProcs', 'copyConf']) it works as expected.

Not sure what the reason it.

tmarshall added a commit to ConjureLabs/hob that referenced this issue Apr 24, 2018
@tmarshall
Copy link
Author

^ full taskfile content (with serial fix) here: https://github.com/ConjureLabs/hob/blob/master/taskfile.js

@hzlmn
Copy link
Collaborator

hzlmn commented Apr 24, 2018

Hi, i guess it is known issue, this is because when you run run tasks in parallel they started at the same time and share same internal context. That's why some internal vars polluted. Simple fix will be just to use serial in copyDirs task.

@tmarshall
Copy link
Author

@hzlmn did that, but seems non-intuitive. Can't scope context per job?

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

2 participants