pm2 --interpreter is not needed anymore

pm2 now recognize the extension of the file but you can still use
interpreter flag for specific extensions.
This commit is contained in:
Jean-Nicolas LAGNEAU 2014-11-12 18:49:07 +01:00
parent cea819b960
commit 7d3bd3fabe
7 changed files with 77 additions and 28 deletions

View File

@ -6,6 +6,7 @@ var fs = require('fs');
var path = require('path');
var util = require('util');
var cronJob = require('cron').CronJob;
var isBinary = require("isbinaryfile");
var UX = require('./CliUx.js');
var cst = require('../constants.js');
@ -61,7 +62,11 @@ Common.resolveAppPaths = function(app, cwd, outputter) {
if (extItps[path.extname(app.script)] != 'node' && path.extname(app.script) != '.coffee')
app.exec_mode = 'fork_mode';
} else {
app.exec_interpreter = 'node';
if (isBinary(app.script)) {
app.exec_interpreter = 'none';
app.exec_mode = 'fork_mode';
} else
app.exec_interpreter = 'node';
}
}

View File

@ -118,39 +118,37 @@
"pm2": "./bin/pm2"
},
"dependencies": {
"async" : "~0.9.0",
"chalk" : "~0.5.1",
"chokidar" : "~0.10.1",
"cli-table" : "0.3.0",
"coffee-script" : "1.8.0",
"colors" : "0.6.2",
"commander" : "2.4.0",
"cron" : "1.0.5",
"debug" : "2.1.0",
"eventemitter2" : "0.4.14",
"json-stringify-safe" : "5.0.0",
"moment" : "~2.8.3",
"nssocket" : "0.5.1",
"pidusage" : "0.1.0",
"axm" : "latest",
"vizion" : "latest",
"pm2-axon" : "2.0.7",
"pm2-axon-rpc" : "0.3.6",
"pm2-deploy" : "latest",
"pm2-multimeter" : "0.1.2",
"pm2-rpc-fallback" : "3.0.9",
"punt" : "2.2.0",
"shelljs" : "0.3.0"
"async": "~0.9.0",
"axm": "latest",
"chalk": "~0.5.1",
"chokidar": "~0.10.1",
"cli-table": "0.3.0",
"coffee-script": "1.8.0",
"colors": "0.6.2",
"commander": "2.4.0",
"cron": "1.0.5",
"debug": "2.1.0",
"eventemitter2": "0.4.14",
"isbinaryfile": "^2.0.2",
"json-stringify-safe": "5.0.0",
"moment": "~2.8.3",
"nssocket": "0.5.1",
"pidusage": "0.1.0",
"pm2-axon": "2.0.7",
"pm2-axon-rpc": "0.3.6",
"pm2-deploy": "latest",
"pm2-multimeter": "0.1.2",
"pm2-rpc-fallback": "3.0.9",
"punt": "2.2.0",
"shelljs": "0.3.0",
"vizion": "latest"
},
"devDependencies": {
"mocha": "^1.20.1",
"should": "^4.0.0",
"better-assert": "^1.0.0",
"promise-spawner": "^0.0.3",
"punt" : "*"
"punt": "*"
},
"optionalDependencies": {
"pm2-logs": "~0.1.1",

40
test/bash/binary.sh Normal file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
echo -e "\033[1mRunning tests:\033[0m"
cd $file_path
#
# Testing pm2 execution of binary files
#
$pm2 start `which watch` -- ls
OUT=`$pm2 prettylist | grep exec_interpreter | sed "s/[\'|,|:]//g" | awk -F' ' '{print $2}'`
[ $OUT = "none" ] || fail "$1"
success "$1"
$pm2 kill
$pm2 start binary-js-file
OUT=`$pm2 prettylist | grep exec_interpreter | sed "s/[\'|,|:]//g" | awk -F' ' '{print $2}'`
[ $OUT = "node" ] || fail "$1"
success "$1"
$pm2 kill
$pm2 start binary-js-file.js
OUT=`$pm2 prettylist | grep exec_interpreter | sed "s/[\'|,|:]//g" | awk -F' ' '{print $2}'`
[ $OUT = "node" ] || fail "$1"
success "$1"
$pm2 kill
$pm2 start binary-py-file.py
OUT=`$pm2 prettylist | grep exec_interpreter | sed "s/[\'|,|:]//g" | awk -F' ' '{print $2}'`
[ $OUT = "python" ] || fail "$1"
success "$1"
$pm2 kill

1
test/fixtures/binary-js-file vendored Normal file
View File

@ -0,0 +1 @@
setInterval(function () {console.log("test")}, 5000)

1
test/fixtures/binary-js-file.js vendored Normal file
View File

@ -0,0 +1 @@
setInterval(function () {console.log("test")}, 5000)

2
test/fixtures/binary-py-file.py vendored Normal file
View File

@ -0,0 +1,2 @@
while True:
print 'hello'

View File

@ -55,6 +55,8 @@ bash ./test/bash/reset.sh
spec "Reset meta"
bash ./test/bash/startOrX.sh
spec "startOrX commands"
bash ./test/bash/binary.sh
spec "binary test"
bash ./test/bash/inside-pm2.sh
spec "Starting a process inside a PM2 process"