{"_id":"tripwire","_rev":"40-07af9479e3fd6036106ec2e318543b77","name":"tripwire","description":"Break out from scripts blocking node.js event loop","dist-tags":{"latest":"4.1.0"},"versions":{"0.6.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"0.6.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.6.x"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"dependencies":{},"devDependencies":{"mocha":"1.2.0"},"homepage":"https://github.com/tjanczuk/tripwire","repository":{"type":"git","url":"git@github.com:tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node checkplatform.js"},"_id":"tripwire@0.6.0","dist":{"shasum":"92fe147753f6f3ab223d8694fd1e9b2cea6003e1","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-0.6.0.tgz","integrity":"sha512-WluseZ8BceDq31tRbRjDtElqff0LaRxr6BHfIR4MhE3PpKu/hy2WCNQudjsYStypL8cB5TfYhnurFqd+aD8amw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCs9oFzDjnQRFalkmjo8728YzQ1Tgec1F1wekCsNZsQygIhAISWHxnfptuoaL4ALNQJ4UCRCHE6G3G/tK8fcY0T/3hL"}]},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"directories":{}},"0.7.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"0.7.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.6.x || 0.8.x"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"dependencies":{},"devDependencies":{"mocha":"1.2.0"},"homepage":"https://github.com/tjanczuk/tripwire","repository":{"type":"git","url":"git@github.com:tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node checkplatform.js"},"_id":"tripwire@0.7.0","dist":{"shasum":"8b3d9b12ce5b505b7e8184137773366012e0d746","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-0.7.0.tgz","integrity":"sha512-Bti9M2xVrN37hm+uoH9BRvcJrXmdTxIyt5ZyIEwA8Fi9qYuUehDVbHBNtHCs+f3In8Q4uC5IxS/4Cz8pRIljnA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEvk7D6tOafZLIt9X4OMAZg+x3CDW0vgNC808lSJYvUIAiEA1RTBPHfQd67M2JTJ3FhMVDJq9ZBRzlPSzlnzHuN3tw4="}]},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"tjanczuk","email":"tomasz@janczuk.org"},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}]},"0.8.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"0.8.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.6.x || 0.8.x || 0.10.x"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"homepage":"https://github.com/tjanczuk/tripwire","repository":{"type":"git","url":"git@github.com:tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node checkplatform.js"},"gitHead":"612e3a99e1c245999ca0945dac46f12cb78ad204","_id":"tripwire@0.8.0","_shasum":"c6bdf86270f689aa3a350e401c2ef6e17e643979","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"tjanczuk","email":"tomasz@janczuk.org"},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"dist":{"shasum":"c6bdf86270f689aa3a350e401c2ef6e17e643979","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-0.8.0.tgz","integrity":"sha512-b8PIW19HGnrp1Ofzf2S4XX1wHWEdJOu22TCTh8lPUXtA5pkM95bb88nuBh4FQ0QoUyzREMBpPlBJ8Cd5KXP3oQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCeqjX1B2wEO/jxigN+BFj00nLLde1erYT8eE5i3T7nVwIgXNdu/iR35lBfi6xsSP+N4ZyemrVe069IOcXUQnUJxWI="}]}},"0.9.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"0.9.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.6.x || 0.8.x || 0.10.x"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"homepage":"https://github.com/tjanczuk/tripwire","repository":{"type":"git","url":"git@github.com:tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node install.js"},"gitHead":"ed4a91f2b4199e9f1977b7a6159445de9144ea52","_id":"tripwire@0.9.0","_shasum":"2a5942b5f6c106995a8874688e960f9afb4214d8","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"tjanczuk","email":"tomasz@janczuk.org"},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"dist":{"shasum":"2a5942b5f6c106995a8874688e960f9afb4214d8","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-0.9.0.tgz","integrity":"sha512-U3MTQhjfTq7SyLWJsVO1cILdq4G86wuPQUmuIxScirfnDCfOFYwGvmToYBPcOfvwRV42337gpfNcLfyVgjna0Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICxp8VHA2oesEJAmAWjb4pbIcXWPqgSU0reAiGEd9eEfAiEAm/5ySqJ5enpq5kAvL8TxAeKuW4dIuexMfrK9AI3jHG0="}]}},"0.10.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"0.10.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.10.x || 0.12.x"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"homepage":"https://github.com/tjanczuk/tripwire","dependencies":{"nan":"^1.6.2"},"repository":{"type":"git","url":"git@github.com:tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node install.js"},"gitHead":"c6ab2bb7fa40063e64a3f8798a8c4962fa0b583e","_id":"tripwire@0.10.0","_shasum":"a35243870d36d2520f3573b6f7a1df0c1993cf6e","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.10.30","_npmUser":{"name":"tjanczuk","email":"tomasz@janczuk.org"},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"dist":{"shasum":"a35243870d36d2520f3573b6f7a1df0c1993cf6e","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-0.10.0.tgz","integrity":"sha512-TTjgr5SqxOjrfxcW+IOa/qtmHYzS5izNmQufJGR/hN/9RHsm7QkGW5zgdT8TOz5Tt53/bJd6sTfSSPfB0qGihg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA6B7INmoPM2DM/6aOrIWa6v66PH90DP9kxN458G/sHHAiBM02FGA+ZsMzdzxIcxXAqTHttNQktDdVsdZftNazrNFQ=="}]}},"4.0.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"4.0.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.10.x || 0.12.x || 4.0"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"homepage":"https://github.com/tjanczuk/tripwire","dependencies":{"nan":"^2.0.8"},"repository":{"type":"git","url":"git+ssh://git@github.com/tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node install.js"},"gitHead":"bde8e5cf801088f6f387521daf2bea6738fb4ffb","_id":"tripwire@4.0.0","_shasum":"b2c2ad676f07d11acb9237028a5a8b62f4a20ffa","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.10.30","_npmUser":{"name":"tjanczuk","email":"tomasz@janczuk.org"},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"dist":{"shasum":"b2c2ad676f07d11acb9237028a5a8b62f4a20ffa","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-4.0.0.tgz","integrity":"sha512-mi6boUJ2FbMQ14GbuOjyODGSdf87B8Aem6y0G7qtrDzmOcmWEQ3CM8wltfYprx6ywebOLbiQbK9DLt8LZZWXIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHTwlck16A+alQlquAXT5qJ7QL5x27ZYudqBwM08tsDxAiA7m67qZG+aOiY24g5KW1o2LUD8rsFaEZaYug6ZOqFSrw=="}]}},"4.1.0":{"name":"tripwire","author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"version":"4.1.0","description":"Break out from scripts blocking node.js event loop","tags":["event loop","hang"],"main":"./lib/tripwire.js","engines":{"node":"0.10.x || 0.12.x || 4.x"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"homepage":"https://github.com/tjanczuk/tripwire","dependencies":{"nan":"^2.0.8"},"repository":{"type":"git","url":"git+ssh://git@github.com/tjanczuk/tripwire.git"},"bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"scripts":{"install":"node install.js"},"gitHead":"49f61fce6acfebea91888badb7566e8694922c99","_id":"tripwire@4.1.0","_shasum":"1821b6061fc1f51cc82d4dbacd8333da9e538dd5","_from":".","_npmVersion":"2.14.9","_nodeVersion":"0.12.9","_npmUser":{"name":"tjanczuk","email":"tomasz@janczuk.org"},"maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"dist":{"shasum":"1821b6061fc1f51cc82d4dbacd8333da9e538dd5","tarball":"https://registry.npmjs.org/tripwire/-/tripwire-4.1.0.tgz","integrity":"sha512-VjRe4CEyz7gfiDeFvCLdO1mxsf1ydaa94KgAmzoWd9q1/H81ytR/fAUoIPjFVbgknevpHbSP5HaWZp8qu82AKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHyi4ODzwn5oq3s5H3oZnNCpTE9H//l4JXGPoii/fTO7AiBlXQFjp6r2us/YqG744AoV0k4TLojCdcJAH5GPNeNbSg=="}]},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/tripwire-4.1.0.tgz_1454548802462_0.15932226786389947"}}},"readme":"Tripwire\r\n========\r\n\r\nTripwire allows node.js applications to termiante execution of scripts that block the node.js event loop. For example, you can break out from infinite loops like `while(true)`. This functionality is useful if you are executing untrusted code within your node.js process. \r\n\r\nTripwire contains a native extension of node.js and currently supports Windows, Mac, and Linux. I do take contributions. \r\n\r\nInstall with:\r\n\r\n```\r\nnpm install tripwire\r\n```\r\n\r\nThen in your application, you can put a limit on the total amout of CPU time (kernel and user mode combined) the event loop is blocked before the execution of the script is terminated:\r\n\r\n```javascript\r\nvar tripwire = require('tripwire');\r\n\r\nprocess.on('uncaughtException', function (e) {\r\n  console.log('The event loop was blocked for longer than 2000 milliseconds');\r\n  process.exit(1);\r\n});\r\n\r\n// set the limit of execution time to 2000 milliseconds\r\ntripwire.resetTripwire(2000);\r\n\r\n// execute code that will block the event loop for longer\r\nwhile(true);\r\n\r\n// clear the tripwire (in this case this code is never reached)\r\ntripwire.clearTripwire();\r\n```\r\n\r\nWhen the event loop is blocked for longer than the time specified in the call to `resetTripwire`, tripwire will terminate execution of the script. Node.js will subsequently execute the `uncaughtException` handler if one is registered. The exception passed to `uncaughtException` handler will be `null` in that case. In order to determine whether the exception was indeed caused by tripwire, an optional context can be established during a call to `resetTripwire` and retrtieved with a call to `getContext`. The `getContext` will return `undefined` if the tripwire had not been triggered. \r\n\r\n```javascript\r\nvar tripwire = require('tripwire');\r\n\r\nprocess.on('uncaughtException', function (e) {\r\n  if (undefined === tripwire.getContext())\r\n    console.log('The exception was not caused by tripwire.');\r\n  else\r\n    console.log('The event loop was blocked for longer than 2000 milliseconds');\r\n  process.exit(1);\r\n});\r\n\r\n// set the limit of execution time to 2000 milliseconds\r\nvar context = { someData: \"foobar\" };\r\ntripwire.resetTripwire(2000, context);\r\n```\r\n\r\nFor more samples, see [here](https://github.com/tjanczuk/tripwire/tree/master/samples).\r\n\r\n#### Running tests\r\n\r\nThere are a few mocha tests included that you can run with\r\n\r\n```\r\nmocha -R list\r\n```\r\n\r\n#### Building\r\n\r\nOn OSX and Linux, the native component is built at installation time.\r\n\r\nOn Windows, the native component is included in the repository and not built during `npm install tripwire`.\r\n\r\nYou can rebuild the native component using [node-gyp](https://github.com/TooTallNate/node-gyp/). Currently the native component can be compiled on Windows, Mac, and Linux (I do take contributions).\r\n\r\nOn Windows:\r\n\r\n```\r\nnode-gyp configure build\r\ncopy build\\Release\\tripwire.node lib\\native\\win32\\4.0\\ia32\\\r\n```\r\n","maintainers":[{"name":"tjanczuk","email":"tomasz@janczuk.org"}],"time":{"modified":"2022-06-27T21:29:22.855Z","created":"2012-07-11T01:34:17.890Z","0.1.0":"2012-07-11T01:34:18.405Z","0.2.0":"2012-07-12T00:15:49.664Z","0.3.0":"2012-07-12T17:59:11.252Z","0.4.0":"2012-07-24T00:29:11.115Z","0.5.0":"2012-07-26T23:11:26.554Z","0.6.0":"2012-07-26T23:23:41.529Z","0.7.0":"2013-09-25T05:47:22.065Z","0.8.0":"2014-09-21T13:56:15.132Z","0.9.0":"2014-11-22T00:29:39.331Z","0.10.0":"2015-04-13T23:58:53.602Z","4.0.0":"2015-09-09T00:28:43.846Z","4.1.0":"2016-02-04T01:20:05.250Z"},"author":{"name":"Tomasz Janczuk","email":"tomasz@janczuk.org","url":"http://tomasz.janczuk.org"},"repository":{"type":"git","url":"git+ssh://git@github.com/tjanczuk/tripwire.git"},"users":{"fgribreau":true,"jazzhuang":true,"larwin":true,"foreigner":true,"shanewholloway":true,"rmanalan":true},"homepage":"https://github.com/tjanczuk/tripwire","bugs":{"url":"http://github.com/tjanczuk/tripwire/issues"},"readmeFilename":"README.md"}