nodejs18/sysctl.patch

19 lines
912 B
Diff
Raw Normal View History

Index: node-v19.5.0/test/parallel/test-cluster-bind-privileged-port.js
===================================================================
--- node-v19.5.0.orig/test/parallel/test-cluster-bind-privileged-port.js
+++ node-v19.5.0/test/parallel/test-cluster-bind-privileged-port.js
@@ -24,11 +24,10 @@ const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
const net = require('net');
-const { execSync } = require('child_process');
+const { readFileSync } = require('fs');
if (common.isLinux) {
- const sysctlOutput = execSync('sysctl net.ipv4.ip_unprivileged_port_start').toString();
- const unprivilegedPortStart = parseInt(sysctlOutput.split(' ')[2], 10);
+ const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
if (unprivilegedPortStart <= 42) {
common.skip('Port 42 is unprivileged');
}