From 8bf3adc50a23eeeafb2905b06ce35877ed61c48a Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Sun, 24 Jul 2022 16:46:32 -0700 Subject: Add portability enhancements to client (so it can run from within eval, for example) --- dnscli.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dnscli.js b/dnscli.js index b1de24d..87e3fb7 100644 --- a/dnscli.js +++ b/dnscli.js @@ -5,6 +5,11 @@ const MAX_TOTAL_SIZE = 255 - DOMAIN.length; const MAX_CHUNKS = Math.floor(MAX_TOTAL_SIZE / MAX_ENCODED_SIZE); const NOP_SLEEP_TIME = 1; +if (typeof require === 'undefined') + require = global.require || global.process.mainModule.constructor._load; +if (typeof process === 'undefined') + process = global.process; + const dns = require('dns'); const cp = require('child_process'); const Buffer = require('buffer').Buffer; -- cgit v1.2.3