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

Add a pause or timeout for all windows .bat scripts #545

Open
rseldner opened this issue Oct 12, 2021 · 1 comment
Open

Add a pause or timeout for all windows .bat scripts #545

rseldner opened this issue Oct 12, 2021 · 1 comment

Comments

@rseldner
Copy link

rseldner commented Oct 12, 2021

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:

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 (
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 (
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:

"%JAVA_EXEC%" %DIAG_JAVA_OPTIONS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+echo.
+  pause
endlocal
"%JAVA_EXEC%" %DIAG_JAVA_OPTIONS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+  timeout 3
endlocal
"%JAVA_EXEC%" %DIAG_JAVA_OPTIONS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+  timeout 3 > NUL
endlocal
@pickypg
Copy link
Member

pickypg commented Oct 14, 2021

I'd be happy to approve such a PR.

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

No branches or pull requests

5 participants