@tb.p/serve-media 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server.js +10 -1
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -281,7 +281,16 @@ function startServer({ root, port, host, single }) {
|
|
|
281
281
|
onViewerGone() {
|
|
282
282
|
console.log('Viewer disconnected — shutting down.');
|
|
283
283
|
server.close();
|
|
284
|
-
|
|
284
|
+
// When attached to a console, keep the window open (it would close with
|
|
285
|
+
// the process if the tool was launched via double-click / a shortcut).
|
|
286
|
+
if (process.stdin.isTTY) {
|
|
287
|
+
console.log('Press any key to close.');
|
|
288
|
+
process.stdin.setRawMode(true);
|
|
289
|
+
process.stdin.resume();
|
|
290
|
+
process.stdin.once('data', () => process.exit(0));
|
|
291
|
+
} else {
|
|
292
|
+
process.exit(0);
|
|
293
|
+
}
|
|
285
294
|
},
|
|
286
295
|
});
|
|
287
296
|
return new Promise((resolve, reject) => {
|
package/package.json
CHANGED