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

pipe.MkDirAll runs instantly not sequentially in pipe.Script #4

Open
stephen-soltesz opened this issue Dec 24, 2017 · 0 comments
Open

Comments

@stephen-soltesz
Copy link

In a pipe.Script context, my expectation is that every step runs sequentially, where earlier steps complete before later steps start.

I discovered that a few functions like pipe.MkDirAll run instantly, irrespective of their position in the pipe.Script.

For example:

pipe.Script(
	pipe.System("sleep 2 && test ! -d newdir"),     // wait then fail.
	pipe.MkDirAll("newdir/subdir", 0755),           // runs before first step completes
),

If my understanding is correct, it looks like this behavior could be changed by using a TaskFunc in the implementation of MkDirAll.

For example:

func syncMkDirAll(dir string, perm os.FileMode) pipe.Pipe {
	return pipe.TaskFunc(func(s *pipe.State) error {
		return os.MkdirAll(s.Path(dir), perm)
	})
}

What do you think of making MkDir* a TaskFunc by default?

Thanks!

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

1 participant