This PR proposes three improvements to the `Basic.java` test: 1. Increase Timeout - The current timeout is insufficient when running the test in IntelliJ IDEA. - I propose increasing it by one minute. - The timeout value was last modified on May 13, 2010 (commit [56131863a71c](https://github.com/openjdk/jdk/commit/56131863a71ca552d0a881364bd2b3581e13f058)) and has remained unchanged since then.
2. Fix Incompatibility with Windows (Cygwin vs. Native) - One of the tests executes the `echo` command. - This works in Cygwin but fails when running the test in a pure Windows environment (e.g., IntelliJ IDEA). - I propose replacing echo with `cmd /c echo.`, which produces the same output (a single newline) in Windows, ensuring compatibility. 3. Prevent Autorun Scripts in the `cmd /c set` Command - The test runs `cmd /c set`, but in Windows, this may trigger autorun scripts. - I propose adding the `/d` options to prevent autorun scripts from affecting the test results. These changes improve test reliability and ensure compatibility across different environments. Testing: - Verified that the test runs successfully in IntelliJ IDEA without timeout issues. - Confirmed that `cmd /c echo.` produces the expected output in Windows. - Ensured that `cmd /d /c set` correctly lists environment variables without executing autorun scripts. # Detailed Description ## echo The following test fails in a clean Windows environment (e.g., when run from IntelliJ IDEA without Cygwin): //---------------------------------------------------------------- // Test Runtime.exec(...envp...) with envstrings without any `=' //---------------------------------------------------------------- with following error: Cannot run program "echo": CreateProcess error=2, The system cannot find the file specified ## cmd.exe /c set The following test fails in a Windows environment under specific conditions: //---------------------------------------------------------------- // Test Runtime.exec(...envp...) // Check for sort order of environment variables on Windows. //---------------------------------------------------------------- with following error: >'+=+ BAZ=GORP CONDA_BAT=C:\.......\\miniconda3\\condabin\\conda.bat CONDA_EXE=C:\........\\miniconda3\\Scripts\\conda.exe CONDA_SHLVL=0 FOO=BAR PATH=C:\.........\\miniconda3\\condabin; QUUX= SystemRoot=C:\\WINDOWS _=_ ~=~ '< not equal to '+=+ BAZ=GORP FOO=BAR QUUX= SystemRoot=C:\\WINDOWS _=_ ~=~ ' **Reason** In my environment, Miniconda was installed, which adds a script execution to the **autorun** of `cmd`. This script sets additional environment variables that break this test. To reproduce this bug, you can manually add a custom script to the autorun. I have described the steps in detail in my article: [AutoRun for Windows Command Processor (cmd.exe)](https://www.linkedin.com/pulse/autorun-windows-command-processor-cmdexe-oleksii-sylichenko-fofif). ## Changes - increase timeout by one minute - remove unused import **For Windows** - add `/d` to `winEnvCommand` - to disable the execution of AutoRun commands - replace `echo` with `cmd /c echo.` ------------- Commit messages: - Basic.java: Changes: https://git.openjdk.org/jdk/pull/23933/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23933&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8353489 Stats: 6 lines in 1 file changed: 0 ins; 1 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/23933.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23933/head:pull/23933 PR: https://git.openjdk.org/jdk/pull/23933