diff --git a/src/scripts/starttask.sh b/src/scripts/starttask.sh index 488d0beac..6acbdbe32 100755 --- a/src/scripts/starttask.sh +++ b/src/scripts/starttask.sh @@ -38,9 +38,8 @@ options="-p TimeoutStopSec=10s -p MemoryMax=${memory_limit_mb}M -p OOMScoreAdjus [[ "$BOX_ENV" == "cloudron" ]] && options="${options} -p BindsTo=box.service" # DEBUG has to be hardcoded because it is not set in the tests. --setenv is required for ubuntu 16 (-E does not work) -# NODE_OPTIONS is used because env -S does not work in ubuntu 16/18. # it seems systemd-run does not return the exit status of the process despite --wait -if ! systemd-run --unit "${service_name}" --nice "${nice}" --uid=${id} --gid=${id} ${options} --setenv HOME=${HOME} --setenv USER=${SUDO_USER} --setenv DEBUG=box:* --setenv BOX_ENV=${BOX_ENV} --setenv NODE_ENV=production --setenv NODE_OPTIONS=--unhandled-rejections=strict "${task_worker}" "${task_id}" "${logfile}"; then +if ! systemd-run --unit "${service_name}" --nice "${nice}" --uid=${id} --gid=${id} ${options} --setenv HOME=${HOME} --setenv USER=${SUDO_USER} --setenv DEBUG=box:* --setenv BOX_ENV=${BOX_ENV} --setenv NODE_ENV=production "${task_worker}" "${task_id}" "${logfile}"; then echo "Service ${service_name} failed to run" # this only happens if the path to task worker itself is wrong fi diff --git a/src/taskworker.js b/src/taskworker.js index 0b066a741..982f15263 100755 --- a/src/taskworker.js +++ b/src/taskworker.js @@ -1,4 +1,4 @@ -#!/usr/bin/env node +#!/usr/bin/env -S node --unhandled-rejections=strict 'use strict';