> Doesn't seem to happen with a exec of "/usr/bin/date" so it is most likely something wine+Go specific. Yeah, I did try catting the file and it was fast enough. So you are probably right.
Whats interesting is if I do it indirectly via shell script (then this is only 5 times slower not 28): But still too slow. Hell PHP can't be faster at this than Go. cat /tmp/test #!/bin/sh WINEDEBUG=err-all,fixme-all WINEARCH=win32 /opt/wine-staging/bin/wine cmd.exe /c help == go == func main() { now := time.Now() ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() cmd := exec.CommandContext(ctx, "/tmp/test") //cmd := exec.CommandContext(ctx, "/opt/wine-staging/bin/wine", "cmd", "/c", "help") //cmd.Env = []string{"WINEDEBUG=err-all,fixme-all", "WINEARCH=win32"} output, err := cmd.CombinedOutput() if err != nil { fmt.Println(err) } fmt.Println(string(output)) fmt.Println(time.Now().Sub(now)) } time bin/osexec real 0m5,256s user 0m0,015s sys 0m0,221s BR, Miha On Tuesday, November 19, 2019 at 6:13:23 PM UTC+1, Robert Engels wrote: > > > > > > > > -----Original Message----- > >From: Robert Engels <ren...@ix.netcom.com <javascript:>> > >Sent: Nov 19, 2019 10:54 AM > >To: Ian Lance Taylor <ia...@golang.org <javascript:>>, > miha.v...@gmail.com <javascript:> > >Cc: golang-nuts <golan...@googlegroups.com <javascript:>> > >Subject: Re: [go-nuts] ultra slow os.Exec > > > > > >I am guessing - because it is close to 30 secs (which sounds a lot like a > timeout value) - that there is some problem in hand-off with the file > descriptors and the descriptor is getting locked, causing some sort of > timeout. > > > >If it was "any exe" I'm sure someone would of reported it before. It > should be trivial to write a test. I'll be back... > > > > > > > > > >-----Original Message----- > >>From: Ian Lance Taylor <ia...@golang.org <javascript:>> > >>Sent: Nov 19, 2019 10:28 AM > >>To: miha.v...@gmail.com <javascript:> > >>Cc: golang-nuts <golan...@googlegroups.com <javascript:>> > >>Subject: Re: [go-nuts] ultra slow os.Exec > >> > >>On Tue, Nov 19, 2019 at 7:29 AM <miha.v...@gmail.com <javascript:>> > wrote: > >>> > >>> Robert is right, all 3 examples are the same (they execute the same > command with wine being set up and then teared down again). wine itself is > not an issue. It's go's exec that does something extremely funny. > >> > >>Sorry, I misread the original note. But if I'm reading it correctly > >>now, I find these results pretty hard to believe. Can anybody else > >>replicate them? > >> > >>Ian > >> > >> > >>> On Tuesday, November 19, 2019 at 4:22:47 PM UTC+1, Robert Engels > wrote: > >>>> > >>>> > >>>> I think the point the OP is making is that when he runs the command > from the Linux command line it completes in 2 sec - so the Wine startup > time should not be the issue. > >>>> > >>>> > >>>> -----Original Message----- > >>>> >From: Ian Lance Taylor <ia...@golang.org> > >>>> >Sent: Nov 19, 2019 9:15 AM > >>>> >To: miha.v...@gmail.com > >>>> >Cc: golang-nuts <golan...@googlegroups.com> > >>>> >Subject: Re: [go-nuts] ultra slow os.Exec > >>>> > > >>>> >On Tue, Nov 19, 2019 at 6:52 AM <miha.v...@gmail.com> wrote: > >>>> >> > >>>> >> I'm running windows cli exe on linux via wine using os.Exec > command.. this takes 28s to complete. > >>>> >> If I run the same command via linux cli it takes 2s to complete, > if I run the same command via php's exec it also takes about 2 seconds to > complete. > >>>> >> > >>>> >> == linux cli == > >>>> >> > >>>> >> time WINEDEBUG=err-all,fixme-all WINEARCH=win32 > /opt/wine-staging/bin/wine cmd.exe /c help > >>>> >> .... > >>>> >> real 0m1,366s > >>>> >> user 0m0,002s > >>>> >> sys 0m0,225s > >>>> >> > >>>> >> == php == > >>>> >> cat t.php > >>>> >> <?php > >>>> >> $out=array(); > >>>> >> > >>>> >> exec('WINEDEBUG=err-all,fixme-all WINEARCH=win32 > /opt/wine-staging/bin/wine cmd.exe /c help', $out); > >>>> >> > >>>> >> var_dump($out); > >>>> >> > >>>> >> ..... > >>>> >> > >>>> >> real 0m1,427s > >>>> >> user 0m0,035s > >>>> >> sys 0m0,216s > >>>> >> > >>>> >> > >>>> >> ==go exec== > >>>> >> > >>>> >> func main() { > >>>> >> now := time.Now() > >>>> >> ctx, cancel := context.WithTimeout(context.Background(), > 120*time.Second) > >>>> >> defer cancel() > >>>> >> cmd := exec.CommandContext(ctx, "/opt/wine-staging/bin/wine", > "cmd", "/c", "help") > >>>> >> cmd.Env = []string{"WINEDEBUG=err-all,fixme-all", > "WINEARCH=win32"} > >>>> >> output, err := cmd.CombinedOutput() > >>>> >> if err != nil { > >>>> >> fmt.Println(err) > >>>> >> } > >>>> >> fmt.Println(string(output)) > >>>> >> fmt.Println(time.Now().Sub(now)) > >>>> >> } > >>>> >> > >>>> >> time bin/osexec > >>>> >> > >>>> >> real 0m39,915s > >>>> >> user 0m17,062s > >>>> >> sys 0m0,195s > >>>> >> > >>>> >> > >>>> >> * I have tried to set stdin and std out directly to the one from > os (no difference) > >>>> >> * I have replaced cmd.CombinedOutput with cmd.Run() (no > difference) > >>>> >> > >>>> >> go version > >>>> >> go version go1.13.3 linux/amd64 > >>>> >> I'm totally clueless on what's going on. > >>>> > > >>>> >How long does it take to just run the wine command from the shell? > >>>> > > >>>> >My first guess would certainly be that the problem is in wine, not > in > >>>> >Go's os/exec package. Starting up a Windows emulator has to take a > >>>> >certain amount of time. > >>>> > > >>>> >Ian > >>>> > > >>>> >-- > >>>> >You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > >>>> >To unsubscribe from this group and stop receiving emails from it, > send an email to golan...@googlegroups.com. > >>>> >To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXJZy61dX_UetsKY0r%3DNMcoBcE4sCuFZVzvvPme%3DjTTDg%40mail.gmail.com. > > > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > >>> To unsubscribe from this group and stop receiving emails from it, send > an email to golan...@googlegroups.com <javascript:>. > >>> To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/037e16e2-158a-4cf7-8a5f-8b940d55e64a%40googlegroups.com. > > > >> > >>-- > >>You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > >>To unsubscribe from this group and stop receiving emails from it, send > an email to golan...@googlegroups.com <javascript:>. > >>To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXR3ADH6J28wmY7vneHVnNRpGf0yia8aAyUdSrB62qwQg%40mail.gmail.com. > > > > > >-- > >You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > >To unsubscribe from this group and stop receiving emails from it, send an > email to golan...@googlegroups.com <javascript:>. > >To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/847534479.3807.1574182478713%40wamui-cheeto.atl.sa.earthlink.net. > > > > Doesn't seem to happen with a exec of "/usr/bin/date" so it is most likely > something wine+Go specific. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a1eb71b9-33fb-4081-a525-a1e7ba93fa13%40googlegroups.com.