Compare commits

..

5 Commits

Author SHA1 Message Date
Thomas Hobson 8a89af7512
Merge pull request #366 from Brikaa/pre-commit
Improve pre-commit
2021-10-13 23:17:52 +13:00
Thomas Hobson ddb3703a0d
Merge branch 'master' into pre-commit 2021-10-13 23:17:44 +13:00
Thomas Hobson 94a5568121
Merge pull request #371 from Brikaa/timeout
-1 for no timeout (infinite timeout)
2021-10-13 23:15:29 +13:00
Brikaa 5968090f50 Improve precommit 2021-10-10 18:48:34 +02:00
Brikaa f973ecf281 Add infinite timeout 2021-10-10 17:18:31 +02:00
3 changed files with 22 additions and 8 deletions

View File

@ -146,12 +146,15 @@ class Job {
}); });
} }
const kill_timeout = set_timeout(async _ => { const kill_timeout =
logger.info( (timeout >= 0 &&
`Timeout exceeded timeout=${timeout} uuid=${this.uuid}` set_timeout(async _ => {
); logger.info(
process.kill(proc.pid, 'SIGKILL'); `Timeout exceeded timeout=${timeout} uuid=${this.uuid}`
}, timeout); );
process.kill(proc.pid, 'SIGKILL');
}, timeout)) ||
null;
proc.stderr.on('data', async data => { proc.stderr.on('data', async data => {
if (eventBus !== null) { if (eventBus !== null) {

13
piston
View File

@ -14,6 +14,13 @@ docker_compose(){
fi fi
} }
init_precommit() {
if [ $PISTON_ENV == "dev" ]; then
rm -f .git/hooks/pre-commit
ln -s $(realpath $(dirname "$0"))/pre-commit .git/hooks/pre-commit
fi
}
case $1 in case $1 in
help) help)
echo "=== Piston Management ===" echo "=== Piston Management ==="
@ -59,6 +66,7 @@ case $1 in
restart) docker_compose restart ;; restart) docker_compose restart ;;
start) start)
init_precommit
rm -f .git/hooks/pre-commit rm -f .git/hooks/pre-commit
ln -s "$PISTON_PATH/pre-commit" "$PISTON_PATH/.git/hooks/pre-commit" ln -s "$PISTON_PATH/pre-commit" "$PISTON_PATH/.git/hooks/pre-commit"
docker_compose up -d docker_compose up -d
@ -66,7 +74,10 @@ case $1 in
stop) docker_compose down ;; stop) docker_compose down ;;
bash) docker_compose exec api /bin/bash ;; bash) docker_compose exec api /bin/bash ;;
rebuild) docker_compose build && docker_compose up -d ;; rebuild)
init_precommit
docker_compose build && docker_compose up -d
;;
update) update)
git pull git pull

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
echo "Linting staged files..." echo "Linting staged files..."
npm install npm install > /dev/null || exit 1
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0 [ -z "$FILES" ] && exit 0