Skip to content

Instantly share code, notes, and snippets.

@tshemsedinov
Last active July 22, 2020 20:23
Show Gist options
  • Save tshemsedinov/16dfc5d898848c79c0b4ac09225a6887 to your computer and use it in GitHub Desktop.
Save tshemsedinov/16dfc5d898848c79c0b4ac09225a6887 to your computer and use it in GitHub Desktop.
code 1 on assert
'use strict';
// node 12.14.0
// node 14.3.0, 14.4.0, 14.5.0
// node v15.0.0-pre
const assert = require('assert');
const { Worker } = require('worker_threads');
const worker = new Worker('./worker.js');
worker.on('error', err => {
console.log({ err });
});
worker.on('exit', code => {
console.dir({ code });
});
// Uncomment to get { code: 0 } on exit
// throw new Error('Workers, peasants, we are...');
// Uncomment to get { code: 1 } on exit
// assert(false);
'use strict';
setTimeout(() => {
console.log('hello');
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment