Skip to content

Commit 241160f

Browse files
author
David Hasani
committed
quote paths
1 parent 1562c38 commit 241160f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/core/src/codewhisperer/service/transformByQ/transformMavenHandler.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { throwIfCancelled } from './transformApiHandler'
1313
import { sleep } from '../../../shared/utilities/timeoutUtils'
1414
import path from 'path'
1515
import globals from '../../../shared/extensionGlobals'
16+
import os from 'os'
1617

1718
function collectDependenciesAndMetadata(dependenciesFolderPath: string, workingDirPath: string) {
1819
getLogger().info('CodeTransformation: running mvn clean test-compile with maven JAR')
@@ -22,9 +23,11 @@ function collectDependenciesAndMetadata(dependenciesFolderPath: string, workingD
2223

2324
getLogger().info('CodeTransformation: running Maven extension with JAR')
2425

26+
const quotePath = (p: string) => (os.platform() === 'win32' ? `"${p}"` : p)
27+
2528
const args = [
26-
`-Dmaven.ext.class.path=${jarPath}`,
27-
`-Dcom.amazon.aws.developer.transform.jobDirectory=${dependenciesFolderPath}`,
29+
`-Dmaven.ext.class.path=${quotePath(jarPath)}`,
30+
`-Dcom.amazon.aws.developer.transform.jobDirectory=${quotePath(dependenciesFolderPath)}`,
2831
'clean',
2932
'test-compile',
3033
]
@@ -34,6 +37,14 @@ function collectDependenciesAndMetadata(dependenciesFolderPath: string, workingD
3437
environment = { ...process.env, JAVA_HOME: transformByQState.getSourceJavaHome() }
3538
}
3639

40+
getLogger().info(`CodeTransformation: JAVA_HOME = ${environment.JAVA_HOME}`)
41+
getLogger().info(`CodeTransformation: baseCommand = ${baseCommand}`)
42+
getLogger().info(`CodeTransformation: jarPath = ${jarPath}`)
43+
getLogger().info(`CodeTransformation: args = ${args.join(' ')}`)
44+
getLogger().info(
45+
`CodeTransformation: shell info --> SHELL=${process.env.SHELL}, COMSPEC=${process.env.COMSPEC}, PSModulePath=${process.env.PSModulePath ? 'PowerShell' : 'not set'}`
46+
)
47+
3748
const spawnResult = spawnSync(baseCommand, args, {
3849
cwd: workingDirPath,
3950
shell: true,

0 commit comments

Comments
 (0)