@ -20,33 +20,44 @@ if (process.env.TEST_THREAD_ID) {
exports . tmpDir = path . join ( exports . testDir , exports . tmpDirName ) ;
exports . tmpDir = path . join ( exports . testDir , exports . tmpDirName ) ;
var opensslCli = null ;
var opensslCli = null ;
var inFreeBSDJail = null ;
var localhostIPv4 = null ;
Object . defineProperty ( exports , 'inFreeBSDJail' , {
Object . defineProperty ( exports , 'inFreeBSDJail' , {
get : function ( ) {
get : function ( ) {
if ( inFreeBSDJail !== null ) return inFreeBSDJail ;
if ( process . platform === 'freebsd' &&
if ( process . platform === 'freebsd' &&
child_process . execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
child_process . execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
'1\n' ) {
'1\n' ) {
return true ;
inFreeBSDJail = true ;
} else {
} else {
return false ;
inFreeBSDJail = false ;
}
}
return inFreeBSDJail ;
}
}
} ) ;
} ) ;
Object . defineProperty ( exports , 'localhost_ip v4' , {
Object . defineProperty ( exports , 'localhostIP v4' , {
get : function ( ) {
get : function ( ) {
if ( localhostIPv4 !== null ) return localhostIPv4 ;
if ( exports . inFreeBSDJail ) {
if ( exports . inFreeBSDJail ) {
// Jailed network interfaces are a bit special - since we need to jump
// Jailed network interfaces are a bit special - since we need to jump
// through loops, as well as this being an exception case, assume the
// through loops, as well as this being an exception case, assume the
// user will provide this instead.
// user will provide this instead.
if ( process . env . LOCALHOST )
if ( process . env . LOCALHOST ) {
return process . env . LOCALHOST ;
localhostIPv4 = process . env . LOCALHOST ;
} else {
console . error ( 'Looks like we\'re in a FreeBSD Jail. ' +
console . error ( 'Looks like we\'re in a FreeBSD Jail. ' +
'Please provide your default interface address ' +
'Please provide your default interface address ' +
'as LOCALHOST or expect some tests to fail.' ) ;
'as LOCALHOST or expect some tests to fail.' ) ;
}
}
return '127.0.0.1' ;
}
if ( localhostIPv4 === null ) localhostIPv4 = '127.0.0.1' ;
return localhostIPv4 ;
}
}
} ) ;
} ) ;