Closed spall closed 5 years ago
I am realizing that the intention is probably to not allow this as the user should use "setCurrentDirectory" so I am going to close this issue.
Uses definitely shouldn't use setCurrentDirectory - that is likely to break everything! Instead users should use cmd (Cwd pathIWant) myCommand
- which I pushed support for earlier today.
Oh great! Thanks! Does this let the build change directories and then all subsequent commands occur in that directory?
Nope, it's stateless - it applies to that cmd
alone - you have to include it on every command. Having a withCwd
to Rattle that added it to all inner commands would be possible. It's important not to change the directory in any multithreaded process since it's a system wide state. In Shake if you have --lint
turned on then it periodically checks the current directory and throws an error if it sees it has been changed.
Okay; I think adding a withCmd will be a good idea. I can probably work on that.
I just pushed a patch adding withCmdOptions of the type described in another message. Using that:
withCmdOptions [Cwd "whatever"] $ do
cmd ...
cmd ...
And it will be equivalent to adding Cwd "whatever"
onto all the commands.
It seems that 'cmd "cd"' doesn't work. It produces an error like this:
This seems like a bug to me.