| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1109d0b commit 6e1eb59
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,16 +19,11 @@ const proc = spawn(process.execPath, args, { stdio: 'pipe' }); | |||
| 19 | 19 | proc.stdout.setEncoding('utf8'); | |
| 20 | 20 | proc.stderr.setEncoding('utf8'); | |
| 21 | 21 | ||
| 22 | - function fail() { | ||
| 23 | - common.fail('the program should not hang'); | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - const timer = setTimeout(fail, common.platformTimeout(4000)); | ||
| 27 | - | ||
| 28 | 22 | let stdout = ''; | |
| 29 | 23 | let stderr = ''; | |
| 30 | 24 | ||
| 31 | 25 | let nextCount = 0; | |
| 26 | + let exit = false; | ||
| 32 | 27 | ||
| 33 | 28 | proc.stdout.on('data', (data) => { | |
| 34 | 29 | stdout += data; | |
@@ -38,8 +33,8 @@ proc.stdout.on('data', (data) => { | |||
| 38 | 33 | stdout.includes('> 4') && nextCount < 4) { | |
| 39 | 34 | nextCount++; | |
| 40 | 35 | proc.stdin.write('n\n'); | |
| 41 | - } else if (stdout.includes('{ a: \'b\' }')) { | ||
| 42 | - clearTimeout(timer); | ||
| 36 | + } else if (!exit && (stdout.includes('< { a: \'b\' }'))) { | ||
| 37 | + exit = true; | ||
| 43 | 38 | proc.stdin.write('.exit\n'); | |
| 44 | 39 | } else if (stdout.includes('program terminated')) { | |
| 45 | 40 | // Catch edge case present in v4.x | |
@@ -50,15 +45,6 @@ proc.stdout.on('data', (data) => { | |||
| 50 | 45 | ||
| 51 | 46 | proc.stderr.on('data', (data) => stderr += data); | |
| 52 | 47 | ||
| 53 | - // FIXME | ||
| 54 | - // This test has been periodically failing on certain systems due to | ||
| 55 | - // uncaught errors on proc.stdin. This will stop the process from | ||
| 56 | - // exploding but is still not an elegant solution. Likely a deeper bug | ||
| 57 | - // causing this problem. | ||
| 58 | - proc.stdin.on('error', (err) => { | ||
| 59 | - console.error(err); | ||
| 60 | - }); | ||
| 61 | - | ||
| 62 | 48 | process.on('exit', (code) => { | |
| 63 | 49 | assert.equal(code, 0, 'the program should exit cleanly'); | |
| 64 | 50 | assert.equal(stdout.includes('{ a: \'b\' }'), true, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments