| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4c4132e commit f640baf
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,22 +1,18 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - const common = require('../common'); | ||
| 2 | + require('../common'); | ||
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | const spawn = require('child_process').spawn; | |
| 5 | 5 | ||
| 6 | 6 | // spawn a node child process in "interactive" mode (force the repl) and eval | |
| 7 | 7 | const cp = spawn(process.execPath, ['-i', '-e', 'console.log("42")']); | |
| 8 | 8 | var gotToEnd = false; | |
| 9 | - const timeoutId = setTimeout(function() { | ||
| 10 | - throw new Error('timeout!'); | ||
| 11 | - }, common.platformTimeout(1000)); // give node + the repl 1 second to boot up | ||
| 12 | 9 | ||
| 13 | 10 | cp.stdout.setEncoding('utf8'); | |
| 14 | 11 | ||
| 15 | 12 | var output = ''; | |
| 16 | 13 | cp.stdout.on('data', function(b) { | |
| 17 | 14 | output += b; | |
| 18 | 15 | if (output === '> 42\n') { | |
| 19 | - clearTimeout(timeoutId); | ||
| 20 | 16 | gotToEnd = true; | |
| 21 | 17 | cp.kill(); | |
| 22 | 18 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments