elastic / elastic/support-diagnostics

Add a pause or timeout for all windows .bat scripts

Open
#545 1 comment 0 reactions 0 assignees View on GitHub
diagnostic
Dominant language
Java
Stars
304
Forks
175
PR merge metrics
No merged PRs in 30d

Description

GUI oriented Windows users might simply double click on the .bat scripts to run in interactive mode, which will launch a terminal window to run the script. If java is not found, the terminal window will **immediately** close without the user having a chance to actually read the error. Some users might not know/consider running via a command-line session (rather than double-clicking) to get around this. Adding a pause or timeout would be trivial and give users an opportunity to read the terminal output.
Submitting for discussion prior to PR per contribution guidelines

**Examples:**

```diff
if not defined JAVA_HOME (
set JAVA_EXEC=java
echo No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
+ pause
) else (
```

```diff
if not defined JAVA_HOME (
set JAVA_EXEC=java
echo No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
+ timeout 3
) else (
```
```diff
if not defined JAVA_HOME (
set JAVA_EXEC=java
echo No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
+ timeout 3 > NUL
) else (
```

---

Alternatively, we can add this to the end of the script to keep the window open regardless of the outcome.

**Examples:**

```diff
"%JAVA_EXEC%" %DIAG_JAVA_OPTIONS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+echo.
+ pause
endlocal
```

```diff
"%JAVA_EXEC%" %DIAG_JAVA_OPTIONS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+ timeout 3
endlocal
```

```diff
"%JAVA_EXEC%" %DIAG_JAVA_OPTIONS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+ timeout 3 > NUL
endlocal
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.