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 // hasStdin returns true if we have stdin input
func hasStdin() bool { func hasStdin() bool {
stat, err := os.Stdin.Stat() fi, err := os.Stdin.Stat()
if err != nil { if err != nil {
return false return false
} }
if fi.Mode()&os.ModeNamedPipe == 0 {
isPipedFromChrDev := (stat.Mode() & os.ModeCharDevice) == 0 return false
isPipedFromFIFO := (stat.Mode() & os.ModeNamedPipe) != 0 }
return true
return isPipedFromChrDev || isPipedFromFIFO
} }
// validateOptions validates the configuration options passed // validateOptions validates the configuration options passed