From 4fa712c48f19a9c193e2d4ae8e3b7095e4e88af1 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 13 Jan 2011 15:28:16 -0800 Subject: [PATCH] debugger: error out without script TODO: debug> run script.js --- lib/_debugger.js | 5 +++++ src/node.cc | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index e2f91bc6745..286dc0f60de 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -6,6 +6,11 @@ var spawn = require('child_process').spawn; exports.port = 5858; exports.start = function() { + if (process.argv.length < 3) { + console.error("Usage: node debug script.js"); + process.exit(1); + } + var interface = new Interface(); process.on('uncaughtException', function (e) { console.error("There was an internal error in Node's debugger. " + diff --git a/src/node.cc b/src/node.cc index d23ee8adc2f..bab02aaa9cd 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1832,12 +1832,10 @@ static void ParseDebugOpt(const char* arg) { static void PrintHelp() { printf("Usage: node [options] script.js [arguments] \n" + " node debug script.js [arguments] \n" + "\n" "Options:\n" " -v, --version print node's version\n" - " --debug[=port] enable remote debugging via given TCP port\n" - " without stopping the execution\n" - " --debug-brk[=port] as above, but break in script.js and\n" - " wait for remote debugger to connect\n" " --v8-options print v8 command line options\n" " --vars print various compiled-in variables\n" " --max-stack-size=val set max v8 stack size (bytes)\n" @@ -1846,13 +1844,11 @@ static void PrintHelp() { "NODE_PATH ':'-separated list of directories\n" " prefixed to the module search path,\n" " require.paths.\n" - "NODE_DEBUG Print additional debugging output.\n" "NODE_MODULE_CONTEXTS Set to 1 to load modules in their own\n" " global contexts.\n" - "NODE_DISABLE_COLORS Set to 1 to disable colors in the REPL\n" + "NODE_DISABLE_COLORS Set to 1 to disable colors in the REPL\n" "\n" - "Documentation can be found at http://nodejs.org/api.html" - " or with 'man node'\n"); + "Documentation can be found at http://nodejs.org/\n"); } // Parse node command line arguments.