Skip to content

Commit

Permalink
Make set-max-old-space-size.sh compatible with sh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
0xmichalis committed Feb 7, 2025
1 parent 441dc14 commit 3505814
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .changeset/wise-candles-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 2 additions & 2 deletions scripts/set-max-old-space-size.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

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

export NODE_OPTIONS="${NODE_OPTIONS:-}"

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

0 comments on commit 3505814

Please sign in to comment.