flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.77k stars 362 forks source link

Little bug corrected for windows #227

Open tofgau opened 3 years ago

tofgau commented 3 years ago

Hello,

On windows, a non closed file canot be moved. I had to replace the defer file.Close() by two separate close in order to get this working on windows.

I notify you here but I am not at ease with github.

//defer file.Close()   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
size, err := io.Copy(file, data)
if err != nil {
    os.Remove(tmpname)
    file.Close(); //gaudc  <<<<<<<<<<<<<<<<<<<<<<<<<<<
    return "", err
}
file.Close();//gaudc<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
file.Sync()

newname := paths.Join(m.Path, "new", fmt.Sprintf("%v,S=%v", basename, size))
err = os.Rename(tmpname, newname)
pedroalbanese commented 3 years ago

Greetings @tofgau

How to compile it for Windows? syscall.sigusr1 is not compatible..

Thanks!

cip8 commented 3 years ago

I'm running it on Windows / WSL2 with no problems whatsoever. If you're experiencing strange issues with it, I recommend running it inside WSL2: is super easy & solves all these problems.

pedroalbanese commented 3 years ago

Sorry, I'm on Windows7.. =/

sathishvenkataraman commented 2 years ago

I am new to this and want to run it in windows 11. What are the dependencies needed apart from go? any quick instructions would help, please..