output to file is not working on windows
Closed this issue · 6 comments
Hi,
thanks for creating such an amazing script. Golang's multi-threading is simply unmatched by others.
Writing valid proxies to an output file is not seem to work. I have tried with both -o and --output=file. Could you please check?
Best Regards
@bawzz234 thanks for reporting the issue.
Which version of proxy-check and windows are you using ? i tried with windows 11 and proxy-check 1.0.31 and everything works.
Can you run this and tell me what is the error message:
package main
import (
"fmt"
"os"
)
var text = [4]string{"testing", "write", "to", "file"}
func writeResult(output string, n int) {
if output != "" {
ff, err := os.OpenFile(output, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755)
if err != nil {
panic(err)
}
defer ff.Close()
for _, i := range text {
if n == 1 {
_, err := ff.WriteString(i + "\n")
if err != nil {
panic(err)
}
} else {
_, err := fmt.Fprintln(ff, i)
if err != nil {
panic(err)
}
}
}
}
}
func main() {
fmt.Println("testing with ff.WriteString")
writeResult("output.txt", 1)
fmt.Println("testing with fmt.Fprintln")
writeResult("output2.txt", 2)
}
Iam on Win10 21H2 and for me it will also create no output file, but your test.exe file works without a error message and it will output "output.txt" and output2.txt
@Beykir thx, can you give me the proxy-check --version
and the full command you are using.
test.exe.zip
Here an other binary. with (output, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755)
instead of (output, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
which is use in proxy-check. Does it still work with 0666 ?
version: 1.0.3
command: proxy-check.exe -f input.txt -o output.txt
yes, still works with 0666
@Beykir Ok the function writeResult was only call when -m|--max-valid flag was set. can you try with version 1.0.4
Now it works thank you !!!