fix: #1274 spawned nuclei child process hangs reading stdin

Next and final attempt at fixing the stdin parsing issue when spawing as child from nodejs
This commit is contained in:
Ice3man543 2021-11-29 14:38:55 +05:30
parent 1851e37aef
commit c9943c0b2a

View File

@ -66,15 +66,14 @@ func ParseOptions(options *types.Options) {
// hasStdin returns true if we have stdin input
func hasStdin() bool {
stat, err := os.Stdin.Stat()
fi, err := os.Stdin.Stat()
if err != nil {
return false
}
isPipedFromChrDev := (stat.Mode() & os.ModeCharDevice) == 0
isPipedFromFIFO := (stat.Mode() & os.ModeNamedPipe) != 0
return isPipedFromChrDev || isPipedFromFIFO
if fi.Mode()&os.ModeNamedPipe == 0 {
return false
}
return true
}
// validateOptions validates the configuration options passed