diff options
author | Arseniy Zaostrovnykh <arseniy.zaostrovnykh@sonarsource.com> | 2025-03-05 17:05:36 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2025-03-05 20:03:08 +0000 |
commit | 3022fac3ffda36f6fb580837a0c5c16986c278bd (patch) | |
tree | 04b8b0e6d63e80571afbcde389bd9564fb097dec /sonar-application | |
parent | 9e773383d24c716fe56f334a24c000d8f0575d70 (diff) | |
download | sonarqube-3022fac3ffda36f6fb580837a0c5c16986c278bd.tar.gz sonarqube-3022fac3ffda36f6fb580837a0c5c16986c278bd.zip |
SONAR-24393 Make sonar startup script insensitive to the terminal width
[SONAR-24393](https://sonarsource.atlassian.net/browse/SONAR-24393)
Surprizingly, even when `ps` output is piped into another command, such as `grep` in this case, it is still truncated based on the terminal width. Depending on how wide your terminal you get different results from running the same command:
- Wide-enough terminal:
```
./sonar.sh start
/usr/bin/java
Starting SonarQube...
Started SonarQube.
```
- Not-wide-enough terminal (width = 263 columns):
```
./sonar.sh start
/usr/bin/java
Starting SonarQube...
Removed stale pid file: ./SonarQube.pid
Failed to start SonarQube.
```
To fix that, I propose to run `ps` with `-ww` option, see the [man page](https://man7.org/linux/man-pages/man1/ps.1.html) Tested on `ps` version 4.0.3 and 3.3.17
[SONAR-24393]: https://sonarsource.atlassian.net/browse/SONAR-24393?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Diffstat (limited to 'sonar-application')
-rwxr-xr-x | sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh b/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh index 8f0408e1190..25893e29292 100755 --- a/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh @@ -117,7 +117,7 @@ getpid() { # common is during system startup after an unclean shutdown. # The ps statement below looks for the specific wrapper command running as # the pid. If it is not found then the pid file is considered to be stale. - pidtest=`$PSEXE -p $pid -o args | grep "sonar-application-@sqversion@.jar" | tail -1` + pidtest=`$PSEXE -p $pid -o args -ww | grep "sonar-application-@sqversion@.jar" | tail -1` if [ "X$pidtest" = "X" ] then # This is a stale pid file. |