File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 2121
2222'use strict' ; 
2323const  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+ } 
2436
2537// Skip on OS X Mojave. https://github.com/nodejs/node/issues/21679 
2638if  ( common . isOSX ) 
@@ -35,10 +47,6 @@ if (common.isWindows)
3547if  ( process . getuid ( )  ===  0 ) 
3648  common . skip ( 'Test is not supposed to be run as root.' ) ; 
3749
38- const  assert  =  require ( 'assert' ) ; 
39- const  cluster  =  require ( 'cluster' ) ; 
40- const  net  =  require ( 'net' ) ; 
41- 
4250if  ( cluster . isPrimary )  { 
4351  cluster . fork ( ) . on ( 'exit' ,  common . mustCall ( ( exitCode )  =>  { 
4452    assert . strictEqual ( exitCode ,  0 ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments