Skip to content

Commit 52f2946

Browse files
committed
fix stdin may not found when using in startup script
1 parent d2dc466 commit 52f2946

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

index.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,16 @@ const init = (input) => {
8686
}
8787
};
8888

89-
process.stdin.setRawMode(true);
90-
process.stdin.resume();
91-
process.stdin.on('data', closeListener);
89+
if (process.stdin) {
90+
process.stdin.setRawMode(true);
91+
process.stdin.resume();
92+
process.stdin.on('data', closeListener);
9293

93-
console.log('Press ^R to reload, ^C or ^Z to exit');
94+
console.log('Press ^R to reload, ^C or ^Z to exit');
95+
}
96+
else {
97+
console.log(`Cannot listen to stdin, if you're using DNSProxy in startup script, try killing pid ${process.pid} to terminate`);
98+
}
9499
};
95100

96101
const printHelp = () => {

0 commit comments

Comments
 (0)