Skip to content

Commit 3505814

Browse files
committed
Make set-max-old-space-size.sh compatible with sh
The . operator defaults to the current shell and ignores the shebang so in non-bash shells, it is not bash that will be used, which can result in the following script failure: ``` > . scripts/set-max-old-space-size.sh && hardhat test sh: 8: scripts/set-max-old-space-size.sh: [[: not found ``` The shebang could be respected by avoiding sourcing but a better option is to simply remove the bash dependency from the script since it is not required.
1 parent 441dc14 commit 3505814

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

.changeset/wise-candles-rescue.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

scripts/set-max-old-space-size.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
# This script sets the node `--max-old-space-size` to 8192 if it is not set already.
44
# All existing `NODE_OPTIONS` are retained as is.
55

66
export NODE_OPTIONS="${NODE_OPTIONS:-}"
77

8-
if [[ $NODE_OPTIONS != *"--max-old-space-size"* ]]; then
8+
if [ "${NODE_OPTIONS##*--max-old-space-size*}" = "$NODE_OPTIONS" ]; then
99
export NODE_OPTIONS="${NODE_OPTIONS} --max-old-space-size=8192"
1010
fi

0 commit comments

Comments
 (0)