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

Check if file write failure before reporting success #725

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timothy-mcroy
Copy link

Description of your changes

Checks if there was any file writing error before sending a success message.

Fixes #724

I have:

  • Read and followed terraform-docs' [contribution process].
  • All tests pass when I run make test.

How has this code been tested

vscode ➜ /workspaces/terraform-docs (skipMisleadingSuccessMessage) $ make build && ./bin/linux-amd64/terraform-docs markdown table --output-file test-README.md ./examples/
==> Clean workspace
rm -rf ./bin ./coverage.out
==> Build binary for current OS/ARCH
CGO_ENABLED=0 go build -ldflags="-X github.com/terraform-docs/terraform-docs/internal/version.commit=1d4c250" -o ./bin/linux-amd64/terraform-docs
examples/test-README.md updated successfully
vscode ➜ /workspaces/terraform-docs (skipMisleadingSuccessMessage) $ chmod -w ./examples/test-README.md 
vscode ➜ /workspaces/terraform-docs (skipMisleadingSuccessMessage) $ ./bin/linux-amd64/terraform-docs markdown table --output-file test-README.md ./examples/
Error: open examples/test-README.md: permission denied
vscode ➜ /workspaces/terraform-docs (skipMisleadingSuccessMessage) $ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False reports that an output file was updated successfully when the file write failed
1 participant