aosapps / drone-sonar-plugin

The plugin of Drone CI to integrate with SonarQube (previously called Sonar), which is an open source code quality management platform.
MIT License
30 stars 51 forks source link

sonar-scanner invocation modified to get real-time output #13

Closed awerv closed 4 years ago

awerv commented 4 years ago

I modified the way how the sonar-scanner childprocess is invoked from the plugin to get real-time output. Instead of starting a process, wait for it's unified stdout & stderr and printing it, the process's stdout and stderr can be set to os.Stdout; this way the scanner writes to that channel instantly and it's not necessary to wait for the child to terminate to get output. The only difference in the output is that the first line of the scanner's output is not displayed in the same line as "==> Code Analysis Result:", but appears in the next line instead.

awerv commented 4 years ago

The redirection of sonar-scanner's stderr to os.Stderr seems to behave exactly like if it was written to os.Stdout, the content appears on the web console instantly.