View double-wrap.js
var sw = require('spawn-wrap')
var argv = process.argv.slice(1).map(function (arg) {
if (arg === __filename)
arg = 'double-wrap.js'
return arg
})
var node = process.execPath
var fg = require('foreground-child')
View examples-array-ify.js
// testing converting arguments to an Array
function manualMap () {
var l = arguments.length
var arr = new Array(l)
for (var i = 0; i < l; i ++) arr[i] = arguments[i]
return arr
}
function manualMapArg (x) {
View p.js
var sax = require('./')
var parser = sax.parser()
var xml = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.223 36.223"><title>playbtn</title><path d="M31.957,16.943,5.689,1.777A1.422,1.422,0,0,0,3.555,3.009V33.341a1.422,1.422,0,0,0,2.133,1.232L31.957,19.407a1.422,1.422,0,0,0,0-2.463Z" style="fill:#fff"/></svg>
`
sax.EVENTS.forEach(ev => {
parser['on' + ev] = data => {
console.log('%s %j', ev, data)
}
View p.js
var sax = require('./')
var parser = sax.parser()
var xml = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.223 36.223"><title>playbtn</title><path d="M31.957,16.943,5.689,1.777A1.422,1.422,0,0,0,3.555,3.009V33.341a1.422,1.422,0,0,0,2.133,1.232L31.957,19.407a1.422,1.422,0,0,0,0-2.463Z" style="fill:#fff"/></svg>
`
sax.EVENTS.forEach(ev => {
parser['on' + ev] = data => {
console.log(ev, data);
}
View gist:c23a15eed366a0ad2eccc5d7167a25e4
~blobaum@2605:6000:29c0:3e00:7256:81ff:fea5:ed85 (FreeNode)
07:15 -!- Irssi: Starting query in FreeNode with blobaum
07:15 <blobaum> Please do not conspire against nazis in my holy hebrew language
07:15 <blobaum> Please stop simply hitting, kicking, blocking
07:15 <blobaum> Please stop striking your own people and putting them on a blacklist
07:15 <blobaum> Please stop striking upward
07:17 <blobaum> hebrew is a peaceful language, not for you to go to war with
07:17 <blobaum> knock it off
07:29 <blobaum> fix the relationship you have with me to fix your relationship with the earth
07:29 <blobaum> whatever you ahve done to my head
View 1.tap
1..1
not ok ./tap-emitter {
1..1
not ok 1 - got SIGTERM
---
nobody: expects the SIGTERM
weapons:
- surprise
- fear
...
View t.js
var t = require('tap')
if (process.argv[2] === 'child') {
t.test('parent', function (t) {
return t.test('child', function (t) {
return t.test('grandchild', function (t) {
t.plan(1)
t.fail('this is fine')
})
})
})
View test-exec-flag.js
var sw = require('../')
if (process.argv[2] === 'wrapper') {
// note: this should never happen,
// because -e invocations aren't wrapped
console.error('wrapper')
sw.runMain()
return
}
View t.js
#!/usr/bin/env node
if (process.env.xyz) {
console.log('in t.js, xyz=%j', process.env.xyz)
console.log('gc is a', typeof gc)
console.log('%s %j', process.execPath, process.execArgv.concat(process.argv))
console.log('node@%s', process.version)
console.log('about to run the main file\u001b[32m')
require('./index.js').runMain()
console.log('\u001b[31mran wrapped main')
return