Skip to content

Commit

Permalink
[fix] Fix option parsing for starting actions
Browse files Browse the repository at this point in the history
`RegExp` matched full command line, this gets file from `optimist`, it
should be a bit more reliable.

Fixes #186.
  • Loading branch information
mmalecki committed Dec 7, 2011
1 parent afccdb4 commit ce7d5a1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ app.cmd('cleanlogs', cli.cleanLogs = function () {
// Starts a forever process for the script located at `file` as daemon
// process.
//
app.cmd(/start (.+)/, cli.startDaemon = function (file) {
app.cmd(/start (.+)/, cli.startDaemon = function () {
var file = require('optimist').argv._[1],
options = getOptions(file);

forever.log.info('Forever processing file: ' + file.grey);
var options = getOptions(file);
tryStart(file, options, function () {
var monitor = forever.startDaemon(file, options);
monitor.on('start', function () {
Expand Down Expand Up @@ -451,8 +453,9 @@ app.cmd('help', cli.help = function () {
// Remark: this regex matches everything. It has to be added at the end to
// make executing other commands possible.
//
app.cmd(/(.*)/, cli.start = function (file) {
var options = getOptions(file);
app.cmd(/(.*)/, cli.start = function () {
var file = require('optimist').argv._[0],
options = getOptions(file);
tryStart(file, options, function () {
var monitor = forever.start(file, options);
monitor.on('start', function () {
Expand Down

0 comments on commit ce7d5a1

Please sign in to comment.