Skip to content

Commit 03c6e6a

Browse files
committed
remove process.argv mutation
Fix #916. See that issue for commentary.
1 parent 47ad4eb commit 03c6e6a

File tree

4 files changed

+7
-27
lines changed

4 files changed

+7
-27
lines changed

lib/command.js

Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/node.js

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/command.ls

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ switch
3737
die "Option --map must be either: #{ valid-map-values.join ', ' }"
3838
else o.map = if o.run or o.eval then 'embedded' else 'none'
3939

40-
if args is process.argv
41-
process.argv.0 = process.argv.1
42-
to-insert = if o.stdin
43-
positional
44-
else
45-
if o.run then positional.splice 1 9e9 else []
46-
process.argv.splice 2, 9e9, ...to-insert
47-
4840
if o.require
4941
{filename} = module
5042
module.filename = '.'

src/node.ls

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ module.exports = !(LiveScript) ->
99
LiveScript.run = (code, {filename}:options?, {js, context} = {}) ->
1010
{main} = require
1111
# Hack for relative `require`.
12-
if filename
13-
dirname = path.dirname fs.realpath-sync do
14-
filename = process.argv.1 = path.resolve filename
12+
dirname = if filename
13+
path.dirname fs.realpath-sync filename |>= path.resolve
1514
else
16-
dirname = filename = '.'
15+
filename = '.'
1716
main.paths = main.constructor._node-module-paths dirname
1817
main <<< {filename}
1918
unless js

0 commit comments

Comments
 (0)