Skip to content

Commit 81c3b53

Browse files
authored
Make test script handle runs as root (#787)
The NPM lifecycle scripts can not be run by the root user for security reasons. The full build of the driver repo depends on the `prepare` script run during the build (or after it). The solution for this case is run the prepare script if the current user is the root, the way the driver package will be ready for testing.
1 parent c43b56e commit 81c3b53

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

runTests.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ function finish {
55
}
66
trap finish EXIT
77

8-
npm install -g gulp typescript jest
9-
108
npm ci
119
npm run build -- --no-private
1210

11+
# root users could not run the lifecycle scripts
12+
# so it need will need to run the prepare script
13+
if [ "$EUID" -eq 0 ]
14+
then echo "Running prepare by manually"
15+
npm run lerna -- run prepare --no-private
16+
fi
17+
18+
1319
if [[ ! -z "$1" ]]; then
1420
export NEOCTRL_ARGS="$1"
1521
fi

0 commit comments

Comments
 (0)