From 04fea4ea31cf8f3cf90a0ae25f9ac00588acd640 Mon Sep 17 00:00:00 2001 From: David Chambers Date: Thu, 25 Jan 2024 20:56:44 +0100 Subject: [PATCH] remove `--nodejs` option --- bin/doctest | 35 ++++++++++++++++++++--------------- lib/program.js | 2 -- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/bin/doctest b/bin/doctest index 4e1a7ba..b1020c4 100755 --- a/bin/doctest +++ b/bin/doctest @@ -2,21 +2,26 @@ 'use strict'; -const path = require ('path'); +const {spawn} = require ('node:child_process'); +const path = require ('node:path'); +const process = require ('node:process'); -const args = process.argv.slice (2); -const idx = args.indexOf ('--nodejs'); -const flags = idx >= 0 && idx < args.length - 1; +const command = process.execPath; -require ('child_process') -.spawn ( - process.execPath, - ['--experimental-import-meta-resolve', - '--experimental-vm-modules', - ...(flags ? args[idx + 1].split (/\s+/) : []), - '--', - path.resolve (__dirname, '..', 'lib', 'command.js'), - ...(flags ? [...(args.slice (0, idx)), ...(args.slice (idx + 2))] : args)], - {cwd: process.cwd (), env: process.env, stdio: [0, 1, 2]} -) +const args = [ + ...process.execArgv, + '--experimental-import-meta-resolve', + '--experimental-vm-modules', + '--', + path.resolve (__dirname, '..', 'lib', 'command.js'), + ...(process.argv.slice (2)), +]; + +const options = { + cwd: process.cwd (), + env: process.env, + stdio: [0, 1, 2], +}; + +spawn (command, args, options) .on ('exit', process.exit); diff --git a/lib/program.js b/lib/program.js index 42ae7b4..bc13c10 100644 --- a/lib/program.js +++ b/lib/program.js @@ -12,8 +12,6 @@ program 'specify module system ("commonjs" or "esm")') .option (' --coffee', 'parse CoffeeScript files') -.option (' --nodejs ', - 'pass options directly to the "node" binary') .option (' --prefix ', 'specify Transcribe-style prefix (e.g. ".")') .option (' --opening-delimiter ',