Skip to content

Commit de77ff3

Browse files
"shortenCommandLine": "argfile|auto" should include "vmArgs" (#457)
1 parent 4b773bd commit de77ff3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/LaunchRequestHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ protected CompletableFuture<Response> handleLaunchCommand(Arguments arguments, R
134134
}
135135
} else if (launchArguments.shortenCommandLine == ShortenApproach.ARGFILE) {
136136
try {
137-
Path tempfile = LaunchUtils.generateArgfile(launchArguments.classPaths, launchArguments.modulePaths);
138-
launchArguments.vmArgs += " \"@" + tempfile.toAbsolutePath().toString() + "\"";
137+
Path tempfile = LaunchUtils.generateArgfile(launchArguments.vmArgs, launchArguments.classPaths, launchArguments.modulePaths);
138+
launchArguments.vmArgs = " \"@" + tempfile.toAbsolutePath().toString() + "\"";
139139
launchArguments.classPaths = new String[0];
140140
launchArguments.modulePaths = new String[0];
141141
context.setArgsfile(tempfile);

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/LaunchUtils.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import com.microsoft.java.debug.core.adapter.AdapterUtils;
4141

4242
import org.apache.commons.lang3.ArrayUtils;
43+
import org.apache.commons.lang3.StringUtils;
4344
import org.apache.commons.lang3.SystemUtils;
4445

4546
public class LaunchUtils {
@@ -81,10 +82,14 @@ public static synchronized Path generateClasspathJar(String[] classPaths) throws
8182
* @return the file path of the generated argfile
8283
* @throws IOException Some errors occur during generating the argfile
8384
*/
84-
public static synchronized Path generateArgfile(String[] classPaths, String[] modulePaths) throws IOException {
85+
public static synchronized Path generateArgfile(String vmArgs, String[] classPaths, String[] modulePaths) throws IOException {
8586
String argfile = "";
87+
if (StringUtils.isNotBlank(vmArgs)) {
88+
argfile += vmArgs;
89+
}
90+
8691
if (ArrayUtils.isNotEmpty(classPaths)) {
87-
argfile = "-cp \"" + String.join(File.pathSeparator, classPaths) + "\"";
92+
argfile += " -cp \"" + String.join(File.pathSeparator, classPaths) + "\"";
8893
}
8994

9095
if (ArrayUtils.isNotEmpty(modulePaths)) {

0 commit comments

Comments
 (0)