Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 2b0980f

Browse files
Merge pull request #555 from telerik/vladimirov/fix-android-home-log-trace
Fix getSysInfo when paths to android tools are undefined
2 parents 9f4d4e9 + ab03ee6 commit 2b0980f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sys-info-base.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,25 @@ export class SysInfoBase implements ISysInfo {
9393

9494
private exec(cmd: string, execOptions?: IExecOptions): string | any {
9595
try {
96-
return this.$childProcess.exec(cmd, null, execOptions).wait();
96+
if(cmd) {
97+
return this.$childProcess.exec(cmd, null, execOptions).wait();
98+
}
9799
} catch(e) {
98-
return null;
99-
} // if we got an error, assume not working
100+
// if we got an error, assume not working
101+
}
102+
103+
return null;
100104
}
101105

102106
// `android -h` returns exit code 1 on successful invocation (Mac OS X for now, possibly Linux). Therefore, we cannot use $childProcess
103107
private checkAndroid(pathToAndroid: string): IFuture<boolean> {
104108
return ((): boolean => {
105109
let result = false;
106110
try {
107-
let androidChildProcess = this.$childProcess.spawnFromEvent(pathToAndroid, ["-h"], "close", {}, {throwError: false}).wait();
108-
result = androidChildProcess && androidChildProcess.stdout && _.contains(androidChildProcess.stdout, "android");
111+
if(pathToAndroid) {
112+
let androidChildProcess = this.$childProcess.spawnFromEvent(pathToAndroid, ["-h"], "close", {}, {throwError: false}).wait();
113+
result = androidChildProcess && androidChildProcess.stdout && _.contains(androidChildProcess.stdout, "android");
114+
}
109115
} catch(err) {
110116
this.$logger.trace(`Error while checking is ${pathToAndroid} installed. Error is: ${err.messge}`);
111117
}

0 commit comments

Comments
 (0)