2013-11-21 03:08:52 +08:00
|
|
|
var test = require("tap").test
|
|
|
|
var npm = require.resolve("../../bin/npm-cli.js")
|
|
|
|
var node = process.execPath
|
|
|
|
var spawn = require("child_process").spawn
|
|
|
|
var path = require("path")
|
|
|
|
var pkg = path.resolve(__dirname, "lifecycle-signal")
|
|
|
|
|
|
|
|
test("lifecycle signal abort", function (t) {
|
2013-12-12 02:20:26 +08:00
|
|
|
// windows does not use lifecycle signals, abort
|
2014-04-16 06:31:36 +08:00
|
|
|
if (process.platform === "win32" || process.env.TRAVIS) return t.end()
|
|
|
|
|
2013-11-21 03:08:52 +08:00
|
|
|
var child = spawn(node, [npm, "install"], {
|
|
|
|
cwd: pkg
|
|
|
|
})
|
|
|
|
child.on("close", function (code, signal) {
|
2014-04-16 06:31:36 +08:00
|
|
|
// GNU shell returns a code, no signal
|
|
|
|
if (process.platform === "linux") {
|
|
|
|
t.equal(code, 1)
|
|
|
|
t.equal(signal, null)
|
|
|
|
return t.end()
|
|
|
|
}
|
|
|
|
|
2013-11-21 03:08:52 +08:00
|
|
|
t.equal(code, null)
|
|
|
|
t.equal(signal, "SIGSEGV")
|
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|