Skip to content

Commit

Permalink
Chore: fixes false positives win failitures
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovitDmytro committed Aug 29, 2021
1 parent 0c8e3fa commit f6e0f65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ environment:
job_depends_on: Build
nodejs_version: 16

# # MacOS
# MacOS

- job_name: macOS Node.js v.10
job_group: Tests
Expand All @@ -59,7 +59,7 @@ environment:
job_depends_on: Build
nodejs_version: 16

# # Windows
# Windows

- job_name: Windows Node.js v.10
job_group: Tests
Expand Down
23 changes: 18 additions & 5 deletions tests/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable import/no-commonjs */
const { Module } = require('module');
const path = require('path');
const readline = require('readline');
const dotenv = require('dotenv');

function clearRequireCache() {
Expand Down Expand Up @@ -41,12 +42,24 @@ function loadEnv() {
});
}

// 'SIGKILL'
[ 'SIGTERM', 'SIGINT', 'SIGQUIT' ].forEach(signal => {
process.on(signal, function () {
console.log(`${signal} catched`);
if (process.platform === 'win32') {
const rl = readline.createInterface({
input : process.stdin,
output : process.stdout
});

rl.on('SIGINT', function () {
console.log('readline SIGINT catched');

process.emit('SIGINT');
});
}

[ 'SIGINT', 'exit' ].forEach(signal => {
process.on(signal, function (code) {
console.log(`${signal} catched, code:`, code);
// eslint-disable-next-line no-process-exit
setTimeout(() => process.exit(2), 50);
process.exit(code);
});
});

Expand Down

0 comments on commit f6e0f65

Please sign in to comment.