-
-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
import hostile from 'hostile';
import { promisify } from 'util';
const hostileSet = promisify(hostile.set);
Promise.all([
hostileSet('1.2.3.4', 'test1'),
hostileSet('1.2.3.5', 'test2'),
hostileSet('1.2.3.4', 'test1'),
hostileSet('1.2.3.4', 'test3')
]).then(console.log);
// [ undefined, undefined, undefined, undefined ]in host file:
1.2.3.4 test1
only add one line
import hostile from 'hostile';
import sleep from 'sleep-promise';
import { promisify } from 'util';
const hostileSet = promisify(hostile.set);
Promise.all([
(async () => {
await sleep(200);
await hostileSet('1.2.3.4', 'test1');
})(),
(async () => {
await sleep(200);
await hostileSet('1.2.3.5', 'test2');
})(),
(async () => {
await sleep(200);
await hostileSet('1.2.3.4', 'test1');
})(),
(async () => {
await sleep(200);
await hostileSet('1.2.3.4', 'test3');
})()
]).then(console.log);
// [ undefined, undefined, undefined, undefined ]in host file:
1.2.3.4 test1
only add one line
Metadata
Metadata
Assignees
Labels
No labels