@deerdesign/deertools 1.2.3 → 1.2.4

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/bin/deertools.js CHANGED
@@ -1,3 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- require('../src/cli').main(process.argv.slice(2)).then((code) => { process.exitCode = code; });
3
+ require('../src/cli').main(process.argv.slice(2)).then((code) => {
4
+ process.exit(code || 0);
5
+ }).catch((err) => {
6
+ console.error(err);
7
+ process.exit(1);
8
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deerdesign/deertools",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -187,19 +187,22 @@ async function loginSkillsBrowser(opts = {}) {
187
187
 
188
188
  saveProduct('skills', entry);
189
189
 
190
- res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
190
+ res.writeHead(200, {
191
+ 'Content-Type': 'text/html; charset=utf-8',
192
+ 'Connection': 'close',
193
+ });
191
194
  res.end(renderSkillsLoginPage(null, true));
192
195
 
193
- setTimeout(() => done(null, entry), 500);
196
+ setTimeout(() => done(null, entry), 150);
194
197
  } catch (err) {
195
- res.writeHead(500, { 'Content-Type': 'text/html; charset=utf-8' });
198
+ res.writeHead(500, { 'Content-Type': 'text/html; charset=utf-8', 'Connection': 'close' });
196
199
  res.end(renderSkillsLoginPage(`Wystąpił błąd: ${err.message}`));
197
200
  }
198
201
  });
199
202
  return;
200
203
  }
201
204
 
202
- res.writeHead(404);
205
+ res.writeHead(404, { 'Connection': 'close' });
203
206
  res.end('Not Found');
204
207
  });
205
208
 
@@ -211,7 +214,11 @@ async function loginSkillsBrowser(opts = {}) {
211
214
  if (finished) return;
212
215
  finished = true;
213
216
  clearTimeout(timer);
217
+ if (typeof server.closeAllConnections === 'function') {
218
+ server.closeAllConnections();
219
+ }
214
220
  server.close();
221
+ if (server.unref) server.unref();
215
222
  if (err) reject(err); else resolve(entry);
216
223
  }
217
224