| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 762dc7c commit 21153f1
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ if (!common.opensslCli) | |||
| 12 | 12 | ||
| 13 | 13 | const assert = require('assert'); | |
| 14 | 14 | const tls = require('tls'); | |
| 15 | - const spawn = require('child_process').spawn; | ||
| 15 | + const { execFile } = require('child_process'); | ||
| 16 | 16 | const fixtures = require('../common/fixtures'); | |
| 17 | 17 | ||
| 18 | 18 | function loadPEM(n) { | |
@@ -29,33 +29,15 @@ const options = { | |||
| 29 | 29 | ||
| 30 | 30 | const reply = 'I AM THE WALRUS'; // Something recognizable | |
| 31 | 31 | ||
| 32 | - const server = tls.createServer(options, function(conn) { | ||
| 32 | + const server = tls.createServer(options, (conn) => { | ||
| 33 | 33 | conn.end(reply); | |
| 34 | - }); | ||
| 35 | - | ||
| 36 | - let gotReply = false; | ||
| 37 | - | ||
| 38 | - server.listen(0, function() { | ||
| 34 | + }).listen(0, common.mustCall(() => { | ||
| 39 | 35 | const args = ['s_client', | |
| 40 | 36 | '-cipher', `${options.ciphers}`, | |
| 41 | - '-connect', `127.0.0.1:${this.address().port}`]; | ||
| 42 | - | ||
| 43 | - const client = spawn(common.opensslCli, args); | ||
| 37 | + '-connect', `127.0.0.1:${server.address().port}`]; | ||
| 44 | 38 | ||
| 45 | - client.stdout.on('data', function(data) { | ||
| 46 | - const message = data.toString(); | ||
| 47 | - if (message.includes(reply)) | ||
| 48 | - gotReply = true; | ||
| 49 | - }); | ||
| 50 | - | ||
| 51 | - client.on('exit', function(code) { | ||
| 52 | - assert.strictEqual(code, 0); | ||
| 39 | + execFile(common.opensslCli, args, common.mustSucceed((stdout) => { | ||
| 40 | + assert(stdout.includes(reply)); | ||
| 53 | 41 | server.close(); | |
| 54 | - }); | ||
| 55 | - | ||
| 56 | - client.on('error', assert.ifError); | ||
| 57 | - }); | ||
| 58 | - | ||
| 59 | - process.on('exit', function() { | ||
| 60 | - assert.ok(gotReply); | ||
| 61 | - }); | ||
| 42 | + })); | ||
| 43 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments