Skip to content

Commit 10fd155

Browse files
committed
Always assume process.argv[0] is interpreter
1 parent 3111e76 commit 10fd155

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## [2.0.1] - 2020-08-28
10+
### Fixed
11+
- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150.
12+
13+
914
## [2.0.0] - 2020-08-14
1015
### Changed
1116
- Full rewrite. Now port from python 3.9.0 & more precise following.

argparse.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ const path = require('path')
8989
const repr = util.inspect
9090

9191
function get_argv() {
92-
let argv = process.argv.slice(0)
93-
if (argv[0] === process.execPath) argv.shift()
94-
return argv
92+
// omit first argument (which is assumed to be interpreter - `node`, `coffee`, `ts-node`, etc.)
93+
return process.argv.slice(1)
9594
}
9695

9796
function get_terminal_size() {

0 commit comments

Comments
 (0)