Skip to content

launchInTerminal request doesn't work well in powershell #39530

@testforstephen

Description

@testforstephen
  • VSCode Version: 1.18.1
  • OS Version: Windows 10

Currently, in java debugger, we have provided launchInTerminal feature to support console input. The feature works at cmd.exe. But if the integrated terminal is powershell, the command line doesn't work well.

Below is the launchInTerminal request from debugger to DA.

{
	"command": "runInTerminal",
	"arguments": {
		"kind": "integrated",
		"title": "Java Debug Console",
		"cwd": "c:\\Work\\CodeJava\\sources\\demoApplication",
		"args": [
			"C:\\Program Files\\Java\\jdk1.8.0_152\\jre\\bin\\java",
			"-agentlib:jdwp\u003dtransport\u003ddt_socket,server\u003dn,suspend\u003dy,address\u003dlocalhost:55492",
			"-Dfile.encoding\u003dUTF-8",
			"-cp",
			"C:\\Work\\CodeJava\\sources\\demoApplication\\target\\classes;C:\\Work\\CodeJava\\sources\\demoApplication\\target\\test-classes;C:\\Users\\jinbwan\\.m2\\repository\\junit\\junit\\3.8.1\\junit-3.8.1.jar;C:\\Users\\jinbwan\\.m2\\repository\\io\\reactivex\\rxjava2\\rxjava\\2.1.1\\rxjava-2.1.1.jar;C:\\Users\\jinbwan\\.m2\\repository\\org\\reactivestreams\\reactive-streams\\1.0.0\\reactive-streams-1.0.0.jar;C:\\Users\\jinbwan\\.m2\\repository\\com\\google\\code\\gson\\gson\\2.7\\gson-2.7.jar",
			"com.microsoft.app.App"
		]
	},
	"seq": 2,
	"type": "request"
}

When integrated terminal is powershell, the generated command line format is not right.
image

Errors happen at -Dfile.encoding=UTF-8 and -cp path1;path2. Need wrap them with single quote '-Dfile.encoding=UTF-8' -cp 'path1;path2'.

The simplest solution is to wrap each command line argument with additional single quote ' when detecting the integrated terminal is powershell.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issuesverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions