Skip to content

Commit

Permalink
Take 2 in getting rid of deprecation warnigns (#85)
Browse files Browse the repository at this point in the history
* try #2 on getting rid of deprecation warning

* change file
  • Loading branch information
kenotron committed Apr 25, 2019
1 parent dafe632 commit 5c9af45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 11 additions & 0 deletions common/changes/just-task/dep2_2019-04-25-21-47.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "just-task",
"comment": "really get rid of deprecation warning",
"type": "patch"
}
],
"packageName": "just-task",
"email": "kchau@microsoft.com"
}
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 5c9af45

Please sign in to comment.