[Pkg-javascript-commits] [node-tap] 12/19: Install node module
Jérémy Lal
kapouer at moszumanska.debian.org
Sat Nov 12 01:03:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
kapouer pushed a commit to branch master
in repository node-tap.
commit 5b03089a0210b6cc97eafd85fe959d6bfb22423b
Author: Jérémy Lal <kapouer at melix.org>
Date: Fri Nov 11 18:53:09 2016 +0100
Install node module
---
debian/links | 1 +
debian/nodemodules/foreground-child.js | 80 ++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+)
diff --git a/debian/links b/debian/links
index 147c6da..ea0f573 100644
--- a/debian/links
+++ b/debian/links
@@ -1 +1,2 @@
usr/lib/nodejs/tap/bin/tap.js usr/bin/tap
+debian/nodemodules usr/lib/nodejs/tap/node_modules
diff --git a/debian/nodemodules/foreground-child.js b/debian/nodemodules/foreground-child.js
new file mode 100644
index 0000000..aa48c6f
--- /dev/null
+++ b/debian/nodemodules/foreground-child.js
@@ -0,0 +1,80 @@
+var signalExit = require('signal-exit')
+var spawn = require('child_process').spawn
+if (process.platform === 'win32') {
+ spawn = require('cross-spawn')
+}
+
+module.exports = function (program, args, cb) {
+ var arrayIndex = arguments.length
+
+ if (typeof args === 'function') {
+ cb = args
+ args = undefined
+ } else {
+ cb = Array.prototype.slice.call(arguments).filter(function (arg, i) {
+ if (typeof arg === 'function') {
+ arrayIndex = i
+ return true
+ }
+ })[0]
+ }
+
+ cb = cb || function (done) {
+ return done()
+ }
+
+ if (Array.isArray(program)) {
+ args = program.slice(1)
+ program = program[0]
+ } else if (!Array.isArray(args)) {
+ args = [].slice.call(arguments, 1, arrayIndex)
+ }
+
+ var spawnOpts = { stdio: [0, 1, 2] }
+
+ if (process.send) {
+ spawnOpts.stdio.push('ipc')
+ }
+
+ var child = spawn(program, args, spawnOpts)
+
+ var childExited = false
+ signalExit(function (code, signal) {
+ child.kill(signal || 'SIGHUP')
+ })
+
+ child.on('close', function (code, signal) {
+ // Allow the callback to inspect the child’s exit code and/or modify it.
+ process.exitCode = signal ? 128 + signal : code
+
+ cb(function () {
+ childExited = true
+ if (signal) {
+ // If there is nothing else keeping the event loop alive,
+ // then there's a race between a graceful exit and getting
+ // the signal to this process. Put this timeout here to
+ // make sure we're still alive to get the signal, and thus
+ // exit with the intended signal code.
+ setTimeout(function () {}, 200)
+ process.kill(process.pid, signal)
+ } else {
+ // Equivalent to process.exit() on Node.js >= 0.11.8
+ process.exit(process.exitCode)
+ }
+ })
+ })
+
+ if (process.send) {
+ process.removeAllListeners('message')
+
+ child.on('message', function (message, sendHandle) {
+ process.send(message, sendHandle)
+ })
+
+ process.on('message', function (message, sendHandle) {
+ child.send(message, sendHandle)
+ })
+ }
+
+ return child
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap.git
More information about the Pkg-javascript-commits
mailing list