Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
chore: Support embedded mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Krems committed Dec 21, 2016
1 parent 2a96fa2 commit 1c31bf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 12 additions & 2 deletions lib/_inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ const { spawn } = require('child_process');
const { EventEmitter } = require('events');
const util = require('util');

const InspectClient = require('./internal/inspect_client');
const createRepl = require('./internal/inspect_repl');
const [ InspectClient, createRepl ] =
(typeof __dirname !== 'undefined') ?
// This copy of node-inspect is on-disk, relative paths make sense.
[
require('./internal/inspect_client'),
require('./internal/inspect_repl')
] :
// This copy of node-inspect is built into the node executable.
[
require('node-inspect/lib/internal/inspect_client'),
require('node-inspect/lib/internal/inspect_repl')
];

const debuglog = util.debuglog('inspect');

Expand Down
5 changes: 4 additions & 1 deletion test/cli/start-cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict';
const spawn = require('child_process').spawn;

const CLI = require.resolve('../../cli.js');
const CLI =
process.env.USE_EMBEDDED_NODE_INSPECT === '1' ?
'inspect' :
require.resolve('../../cli.js');

function startCLI(args) {
const child = spawn(process.execPath, [CLI, ...args]);
Expand Down

0 comments on commit 1c31bf7

Please sign in to comment.