Skip to content

Commit 79753b2

Browse files
committed
Update emaultor.ts with chmod operation.
1 parent afea52d commit 79753b2

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

scripts/emulator-testing/emulators/emulator.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,22 @@ export abstract class Emulator {
8383
});
8484
}
8585
);
86-
// Copy to cache when the download completes, and resolve
87-
// the promise returned by this method.
86+
8887
downloadPromise.then(
8988
() => {
9089
console.log('Download complete');
91-
this.binaryPath = filepath;
92-
if (this.copyToCache()) {
93-
console.log(`Cached emulator at ${this.cacheBinaryPath}`);
94-
}
95-
resolve();
90+
// Change emulator binary file permission to 'rwxr-xr-x'.
91+
// The execute permission is required for it to be able to start
92+
// with 'java -jar'.
93+
fs.chmod(filepath, 0o755, err => {
94+
if (err) reject(err);
95+
console.log(`Changed emulator file permissions to 'rwxr-xr-x'.`);
96+
this.binaryPath = filepath;
97+
if (this.copyToCache()) {
98+
console.log(`Cached emulator at ${this.cacheBinaryPath}`);
99+
}
100+
resolve();
101+
});
96102
},
97103
() => {
98104
reject();

0 commit comments

Comments
 (0)