Skip to content

Commit

Permalink
fix running from cli (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshuawuyts authored Oct 18, 2017
1 parent 5f2d276 commit b6fc071
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/env node

var why = require('./')
var spawn = require('child_process').spawn
var path = require('path')

var prog = path.resolve(process.argv[2])

console.log('probing program', prog)
console.log('kill -SIGUSR1', process.pid, 'for logging')

require(prog)

process.on('SIGUSR1', why)
var nodeArgs = [
'--expose-internals',
'-r',
path.join(__dirname, 'include.js')
]
var nodeOpts = { stdio: 'inherit' }
spawn('node', nodeArgs.concat(prog), nodeOpts)
3 changes: 3 additions & 0 deletions include.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var why = require('./')

process.on('SIGUSR1', why)

0 comments on commit b6fc071

Please sign in to comment.