Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a1d7954

Browse filesBrowse files
AdamMajerruyadorno
authored andcommitted
test: avoid trying to call sysctl directly
sysctl is often installed in /usr/sbin, which is not conveniently accessible to non-root. Secondly, the setting can just be read directly from the standard location and does not need to be parsed in any special fashion. PR-URL: #46366 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent a64d7f4 commit a1d7954
Copy full SHA for a1d7954

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-cluster-bind-privileged-port.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-bind-privileged-port.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ const common = require('../common');
2424
const assert = require('assert');
2525
const cluster = require('cluster');
2626
const net = require('net');
27-
const { execSync } = require('child_process');
27+
const { readFileSync } = require('fs');
2828

2929
if (common.isLinux) {
30-
const sysctlOutput = execSync('sysctl net.ipv4.ip_unprivileged_port_start').toString();
31-
const unprivilegedPortStart = parseInt(sysctlOutput.split(' ')[2], 10);
30+
const unprivilegedPortStart = parseInt(readFileSync('/proc/sys/net/ipv4/ip_unprivileged_port_start'));
3231
if (unprivilegedPortStart <= 42) {
3332
common.skip('Port 42 is unprivileged');
3433
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.