Skip to content

Commit

Permalink
Replace grep with bash's regex operator
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanHowell authored and alexeagle committed Jan 30, 2020
1 parent 8854bfd commit 9fb080b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions internal/node/node_patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,9 @@ set Path=${nodeDir};%Path%
}
else {
fs$1.writeFileSync(path.join(nodeDir, 'node'), `#!/bin/bash
export NP_PATCHED_NODEJS=${nodeDir}
export PATH=${nodeDir}:$PATH
hasScript=\`echo "$@" | grep ${path.basename(requireScriptName)}\`
if [ "$hasScript"=="" ]; then
export NP_PATCHED_NODEJS="${nodeDir}"
export PATH="${nodeDir}":\$PATH
if [[ ! "\${@}" =~ "${file}" ]]; then
exec ${process.execPath} --require "${requireScriptName}" "$@"
else
exec ${process.execPath} "$@"
Expand Down
7 changes: 3 additions & 4 deletions packages/node-patches/src/subprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ set Path=${nodeDir};%Path%
} else {
fs.writeFileSync(
path.join(nodeDir, 'node'), `#!/bin/bash
export NP_PATCHED_NODEJS=${nodeDir}
export PATH=${nodeDir}:$PATH
hasScript=\`echo "$@" | grep ${path.basename(requireScriptName)}\`
if [ "$hasScript"=="" ]; then
export NP_PATCHED_NODEJS="${nodeDir}"
export PATH="${nodeDir}":\$PATH
if [[ ! "\${@}" =~ "${file}" ]]; then
exec ${process.execPath} --require "${requireScriptName}" "$@"
else
exec ${process.execPath} "$@"
Expand Down

0 comments on commit 9fb080b

Please sign in to comment.