RFR: 8340311: JPackage app-image exe launches multiple exe's in JDK 22+

Alexey Semenyuk asemenyuk at openjdk.org
Thu Oct 31 05:03:28 UTC 2024


On Wed, 30 Oct 2024 23:05:41 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

>> Support `win.norestart` application property in jpackage .cfg file. If found in the .cfg file and set to `true`, it forces the Windows app launcher not to restart the launcher process.
>> 
>> Collateral changes to the tests:
>>  - Added `WindowsHelper.killProcess()` to kill process by PID;
>>  - Added `WindowsHelper.findAppLauncherPID()` that will return PIDs of the running app launcher processes for the given app launcher name. The implementation grabbed from `Win8301247Test` test;
>>  - Rework `CfgFile` to make it R/W and capable of writing multiple instances of the same key;
>>  - Added `JPackageCommand.ignoreFakeRuntime()` to ignore external runtime if it is a stub. Should speed up local test runs.
>
> src/jdk.jpackage/share/native/applauncher/CfgFile.cpp line 247:
> 
>> 245:     iss >> intValue;
>> 246: 
>> 247:     return intValue != 0;
> 
> Can you explain what this code does?

It parses an integer from the `str` string.

> test/jdk/tools/jpackage/windows/WinNoRestartTest.java line 24:
> 
>> 22:  */
>> 23: 
>> 24:  /* @test
> 
> Formatting. Delete extra space.

Also imports section and jtreg declaration are in the wrong order

> test/jdk/tools/jpackage/windows/WinNoRestartTest.java line 108:
> 
>> 106: 
>> 107:                 // Get PID of the main app launcher process
>> 108:                 final long pid = findAppLauncherPID(cmd, null,
> 
> If I am reading code correctly `TKit.assertEquals` will throw exception, which means `killProcess` might not be called in case if we expecting 1 process, but we got 2.

Good catch! I didn't think through it well. Will rework

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21726#discussion_r1823772943
PR Review Comment: https://git.openjdk.org/jdk/pull/21726#discussion_r1823773890
PR Review Comment: https://git.openjdk.org/jdk/pull/21726#discussion_r1823774247


More information about the core-libs-dev mailing list