From bb0e000175d8ded44bb59669c9c0508f2cd5112c Mon Sep 17 00:00:00 2001 From: Geoff Schmidt Date: Mon, 29 Apr 2013 13:15:21 -0700 Subject: [PATCH] error handling for 'meteor run-command' --- tools/meteor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/meteor.js b/tools/meteor.js index 19014a4a6e..5c06591ebc 100644 --- a/tools/meteor.js +++ b/tools/meteor.js @@ -998,11 +998,17 @@ Fiber(function () { process.exit(1); } + if (! fs.existsSync(argv._[0]) || + ! fs.statSync(argv._[0]).isDirectory()) { + process.stderr.write(argv._[0] + ": not a directory\n"); + process.exit(1); + } + // Make the directory visible as a package. Derive the last // package name from the last component of the directory, and // bail out if that creates a conflict. var packageDir = path.resolve(argv._[0]); - var packageName = "tool-" + path.basename(packageDir); + var packageName = path.basename(packageDir) + "-tool"; if (context.library.get(packageName, false)) { process.stderr.write("'" + packageName + "' conflicts with the name " + "of a package in the library");