rake icon indicating copy to clipboard operation
rake copied to clipboard

Does `nowrite` ever take effect?

Open avdi opened this issue 5 years ago • 2 comments

--dry-run sets both nowrite(false) and options.dry_run = true. The thing is, so long as options.dry_run == true, Task execution short-circuits before it ever gets to execute any FileUtils methods.

So the question is... does nowrite/noop ever take effect?

The only way I can find to get Rake to tell me what it would do (without doing it) is:

$ rake -E 'Rake.nowrite(true)' 

(That's the behavior I expected from --dry-run, honestly.)

So... are the noop/nowrite branches effectively dead code? Or am I missing something?

avdi avatar Sep 25 '20 01:09 avdi

(For comparison, GNU Make's --dry-run/-n prints the commands it WOULD execute, without executing them.)

avdi avatar Sep 25 '20 02:09 avdi

This also seems to make the when_writing method useless, since it would always be true?

jasonkarns avatar Aug 03 '22 15:08 jasonkarns