DBDocs build output goes to stderr

Hello!

Don’t know if it’s correct or not but when I call dbdocs build ... with my project all output goes to stderr.

Steps to reproduce:

  1. Run dbdocs build --project projectName --password=myPassword projectName.dbml > output.log 2> output_err.log
  2. Check output.log and output_err.log

I assume that command execution went without failures.

Expected result:

  • output.log contains all info about created diagram
  • output_err.log is empty

Actual result:

  • output.log is empty
  • output_err.log contains all info about created diagram

Used version: dbdocs/0.7.2 darwin-x64 node-v16.13.2
OS: macOS Monterey 12.6, macbook on intel chip

May be I do something wrong.

Thanks in advance for helping and for your project. Its really very useful :slight_smile:

Hi Andrey,

Your observation is correct, indeed the spinner that we use for build command will write to stderr by default. For other commands that don’t use the spinner, the output should use the correct stream.

This behavior is clearly an oversight and should be fixed soon.

Thanks for letting us know.

Hi,

After some consideration, we think that the spinner’s text message is mainly for users to read in TTY mode terminal and is not the intended ‘normal’ output for piped/CI environment. Therefore, we think that those messages are best left in stderr.

In the future, we might add proper output to stdout for build command. For error reporting, diagnostic logs, and user messages, stderr, we think is normally the better choice.

The intention here is that for piped commands like dbdocs build example.dbml > out.log, the user is still able to see the message in their terminal due to it being written to stderr. In fact, many CLI apps follow this ‘convention’ of using stdout for output and stderr for messaging.

For now, in your case, I suggest just writing both streams into a single file and checking the process exit code to really know if there are any issues.

I hope this will help

Thanks.

1 Like