Skip to content

Commit

Permalink
try #2 on getting rid of deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kenotron committed Apr 25, 2019
1 parent dafe632 commit a012a02
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/just-task/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ import { JustTaskRegistry } from './JustTaskRegistry';
import yargs from 'yargs';

const originalEmitWarning = process.emitWarning;
process.emitWarning = function emitWarning(warning: string | Error, name?: string, ctor?: Function) {
if (name === 'DEP0097') {

(process.emitWarning as any) = function emitWarning(this: any, warning: string, type: string, code: string, ctor?: Function) {
if (code === 'DEP0097') {
// Undertaker uses a deprecated approach that causes NodeJS 10 to print
// this warning to stderr:
//
// "Using a domain property in MakeCallback is deprecated. Use the async_context
// variant of MakeCallback or the AsyncResource class instead."

// Suppress the warning!
return;
}

return originalEmitWarning(warning, name, ctor);
return originalEmitWarning.apply(this, arguments);
};

yargs
Expand Down

0 comments on commit a012a02

Please sign in to comment.