Merge pull request #6675 from abernix/fix-dev-bundle-bin-command-exit-status

"meteor npm/node" should return exit code from command
This commit is contained in:
Ben Newman
2016-04-01 11:55:36 -04:00
6 changed files with 61 additions and 1 deletions

View File

@@ -1,4 +1,18 @@
if (! require("./cli/dev-bundle-bin-commands.js").process) {
var spawnBinProcess = require('./cli/dev-bundle-bin-commands.js').process
if (spawnBinProcess) {
// On Node 0.10 on Windows, stdout and stderr don't get flushed when calling
// `process.exit`. We use a workaround for now, but this should be fixed on
// Node 0.12, so when we upgrade let's remember to remove this clause, and the
// file it requires. See https://github.com/joyent/node/issues/3584
// This same comment and require is in ./cli/main.js
if (process.platform === 'win32') {
require('./tool-env/flush-buffers-on-exit-in-windows.js');
}
spawnBinProcess.on('exit', function (exitCode) {
process.exit(exitCode);
});
} else {
// Set up the Babel transpiler
require('./tool-env/install-babel.js');

View File

@@ -0,0 +1 @@
local

View File

@@ -0,0 +1,8 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-base # Packages every Meteor app needs to have
ecmascript

View File

@@ -0,0 +1 @@
none

View File

@@ -0,0 +1,12 @@
{
"name": "dev-bundle-bin-commands",
"private": true,
"scripts": {
"start": "meteor run",
"exit-with-status": "echo \"This script has an exit status\" && exit 1",
"exit-normally": "echo \"This script will exit normally\" && exit 0"
},
"dependencies": {
"meteor-node-stubs": "~0.2.0"
}
}

View File

@@ -0,0 +1,24 @@
var selftest = require('../tool-testing/selftest.js');
var Sandbox = selftest.Sandbox;
selftest.define("meteor npm run some-script-name - error returns exit status to shell", function () {
var s = new Sandbox();
var run;
s.createApp("myapp", "dev-bundle-bin-commands");
s.cd("myapp");
run = s.run("npm", "run", "exit-with-status");
run.matchErr("This script has an exit status");
run.expectExit(1);
});
selftest.define("meteor npm some-script-name - normal exit returns normal to shell", function () {
var s = new Sandbox();
var run;
s.createApp("myapp", "dev-bundle-bin-commands");
s.cd("myapp");
run = s.run("npm", "run", "exit-normally");
run.match("This script will exit normally");
run.expectExit(0);
});