Better error handling in jvm-launch-util
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pivotal-tools/jvm-launch-utils",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.14",
|
||||
"description": "Provides utilities useful for launching Java processes from node packages.",
|
||||
"files": [
|
||||
"src",
|
||||
|
||||
@@ -55,15 +55,19 @@ export interface JVM {
|
||||
* toolsjar and to check whether the JVM is a JDK.
|
||||
*/
|
||||
export function findJvm(javaHome?: string) : Promise<JVM | null> {
|
||||
let javaExe = findJavaExe(javaHome);
|
||||
if (javaExe) {
|
||||
return getJavaInfo(javaExe).then(javaProps => new JVMImpl(
|
||||
javaProps.get("java.home"),
|
||||
javaExe,
|
||||
getMajorVersion(javaProps)
|
||||
));
|
||||
try {
|
||||
let javaExe = findJavaExe(javaHome);
|
||||
if (javaExe) {
|
||||
return getJavaInfo(javaExe).then(javaProps => new JVMImpl(
|
||||
javaProps.get("java.home"),
|
||||
javaExe,
|
||||
getMajorVersion(javaProps)
|
||||
));
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
} catch (e) {
|
||||
return Promise.reject(e);
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user