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

Commit 0da7b4d

Browse files
committed
Correctly fixes issue with Puppeteer hanging (without calling process.exit manually) which exhibited with mocha hanging on travis.
1 parent 79d4faf commit 0da7b4d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

cmd.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if( argv.version ) {
9696
fontface.writeCSSFiles();
9797
} catch(e) {
9898
console.log("GlyphHangerFontFace Error: ", e);
99-
process.exit(1);
99+
process.exitCode = 1;
100100
}
101101

102102
try {
@@ -105,17 +105,15 @@ if( argv.version ) {
105105
}
106106
} catch(e) {
107107
console.log("GlyphHangerSubset Error: ", e);
108-
process.exit(1);
108+
process.exitCode = 1;
109109
}
110110

111111
try {
112112
fontface.output();
113113
} catch(e) {
114114
console.log("GlyphHangerFontFace Error: ", e);
115-
process.exit(1);
115+
process.exitCode = 1;
116116
}
117-
118-
process.exit();
119117
})();
120118
} else { // not using URLs
121119
if( argv.subset ) {

src/GlyphHangerEnvironment.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,14 @@ class GlyphHangerEnvironment {
166166
}
167167

168168
get env() {
169-
if(this.envStr === "jsdom") {
170-
this._env = new JSDOMEnvironment();
171-
} else {
172-
this._env = new PuppeteerEnvironment();
169+
if( !this._env ) {
170+
if(this.envStr === "jsdom") {
171+
this._env = new JSDOMEnvironment();
172+
} else {
173+
this._env = new PuppeteerEnvironment();
174+
}
173175
}
176+
174177
return this._env;
175178
}
176179

0 commit comments

Comments
 (0)