Skip to content

Commit 6a196d1

Browse files
authored
Switch to using the ip command instead of ifconfig when the platform isn't darwin. (#31)
1 parent 3f7c72f commit 6a196d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ip-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ export default class IPManager {
134134
* A base subnet string.
135135
*/
136136
private getAvailableSubnet(): string {
137+
const ifconfig_command = this.config.platform === 'darwin' ? 'ifconfig' : 'ip a'
137138
for (let i = 18; i <= 31; i++) {
138139
const subnet = '172.' + i + '.0'
139-
const existing = execSync('sudo ifconfig | grep ' + subnet + ' | wc -l').toString().trim()
140+
const existing = execSync('sudo ' + ifconfig_command + ' | grep ' + subnet + ' | wc -l').toString().trim()
140141
if (existing === '0') {
141142
return subnet
142143
}

0 commit comments

Comments
 (0)