Skip to content

Commit 99e25d0

Browse files
committed
honor nvm
1 parent 95d4b46 commit 99e25d0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

nodeapp/nodebb.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
* Our shim for nodebb production mode and PM2 compatibility.
33
*/
44
const { exec } = require('child_process');
5-
const startCmd = './nodebb start';
6-
const stopCmd = './nodebb stop';
5+
const startCmd = 'nodebb start';
6+
const stopCmd = 'nodebb stop';
7+
const nvmCmd = 'bash -c "export NVM_DIR=/opt/nvm && source /opt/nvm/nvm.sh && nvm use && ';
78

89
const start = () => {
910
console.log('Starting nodebb...');
10-
exec(startCmd, (error, stdout, stderr) => {
11+
exec(nvmCmd + startCmd + '"', (error, stdout, stderr) => {
1112
if (error) {
1213
console.error(`Error starting nodebb: ${error}`);
1314
} else {
@@ -18,7 +19,7 @@ const start = () => {
1819

1920
const stop = () => {
2021
console.log('Stopping nodebb...');
21-
exec(stopCmd, (error, stdout, stderr) => {
22+
exec(nvmCmd + stopCmd + '"', (error, stdout, stderr) => {
2223
if (error) {
2324
console.error(`Error stopping nodebb: ${error}`);
2425
} else {

0 commit comments

Comments
 (0)