File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 21
21
22
22
'use strict' ;
23
23
const common = require ( '../common' ) ;
24
+ const assert = require ( 'assert' ) ;
25
+ const cluster = require ( 'cluster' ) ;
26
+ const net = require ( 'net' ) ;
27
+ const { execSync } = require ( 'child_process' ) ;
28
+
29
+ if ( common . isLinux ) {
30
+ const sysctlOutput = execSync ( 'sysctl net.ipv4.ip_unprivileged_port_start' ) . toString ( ) ;
31
+ const unprivilegedPortStart = parseInt ( sysctlOutput . split ( ' ' ) [ 2 ] , 10 ) ;
32
+ if ( unprivilegedPortStart <= 42 ) {
33
+ common . skip ( 'Port 42 is unprivileged' ) ;
34
+ }
35
+ }
24
36
25
37
// Skip on OS X Mojave. https://github.com/nodejs/node/issues/21679
26
38
if ( common . isOSX )
@@ -35,10 +47,6 @@ if (common.isWindows)
35
47
if ( process . getuid ( ) === 0 )
36
48
common . skip ( 'Test is not supposed to be run as root.' ) ;
37
49
38
- const assert = require ( 'assert' ) ;
39
- const cluster = require ( 'cluster' ) ;
40
- const net = require ( 'net' ) ;
41
-
42
50
if ( cluster . isPrimary ) {
43
51
cluster . fork ( ) . on ( 'exit' , common . mustCall ( ( exitCode ) => {
44
52
assert . strictEqual ( exitCode , 0 ) ;
You can’t perform that action at this time.
0 commit comments