test: fix path to module for repl test on Windows

Use path join to construct the path instead of concatenating strings.
Replace backslash with double backslash so that they are escaped
correctly in the string passed to REPL.

PR-URL: https://github.com/nodejs/node/pull/3608
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
pull/3831/merge
Michael Cornacchia 2015-10-30 12:08:49 -04:00 committed by James M Snell
parent 84f09647d0
commit c0bac95147
1 changed files with 6 additions and 2 deletions

View File

@ -1,10 +1,14 @@
'use strict';
require('../../common');
var common = require('../../common');
var assert = require('assert');
var repl = require('repl');
var stream = require('stream');
var path = require('path');
var buildType = process.config.target_defaults.default_configuration;
var buildPath = __dirname + '/build/' + buildType + '/binding';
var buildPath = path.join(__dirname, 'build', buildType, 'binding');
// On Windows, escape backslashes in the path before passing it to REPL.
if (common.isWindows)
buildPath = buildPath.replace(/\\/g, '/');
var cb_ran = false;
process.on('exit', function() {