UPDATED: Calling rmdir from Makefile not working

Update: User error! I missed the line in the description of the Windows environment that stated Git Bash is the shell used o run the builds. :blush:

When building with our Makefile on Windows we use the standard command rmdir /Q /S to delete a directory. i.e.

clean-docs:
	rmdir /Q /S docs

This works as expected when the make is run on a real Windows 10 laptop. However, when the make is run in a Travis Windows environment the delete step fails, seemingly because the /Q and /S options are being treated as directories…

rmdir /Q /S docs
The command "make build test verify-docs" exited with 2.

Done. Your build exited with 1.
rmdir: failed to remove '/Q': No such file or directory
rmdir: failed to remove '/S': No such file or directory
rmdir: failed to remove 'docs': Directory not empty
make: *** [Makefile:85: clean-docs] Error 1

Has anyone else seen this behaviour? Is there a known workaround?

Thanks,
George

Yes, I am getting the same error. Did you get the solution of it?

This is because Travis CI uses Git Bash as the shell in its Windows environment, where rmdir is the Unix-style command and not the cmd.exe built-in command.

If your makefile expects to use cmd.exe as the shell on Windows, you can export SHELL=$(realpath $COMSPEC) before running make.