Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/java.base/unix/classes/java/lang/ProcessImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,26 @@ private static LaunchMechanism launchMechanism() {
// Should be value of a LaunchMechanism enum
LaunchMechanism lm = LaunchMechanism.valueOf(s.toUpperCase(Locale.ROOT));
switch (OperatingSystem.current()) {
case LINUX:
return lm; // All options are valid for Linux
case LINUX: {
// All options are valid for Linux, but VFORK is deprecated and results
// in a warning
if (lm == LaunchMechanism.VFORK) {
System.err.println("VFORK MODE DEPRECATED");
System.err.println("""
The VFORK launch mechanism has been deprecated for being dangerous.
It will be removed in a future java version. Either remove the
jdk.lang.Process.launchMechanism property (preferred) or use FORK mode
instead (-Djdk.lang.Process.launchMechanism=FORK).
""");
}
return lm;
}
case AIX:
case MACOS:
if (lm != LaunchMechanism.VFORK) {
return lm; // All but VFORK are valid
}
break;
case WINDOWS:
// fall through to throw to Error
}
} catch (IllegalArgumentException e) {
}
Expand Down