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 <i...@golang.org> >Sent: Nov 19, 2019 9:15 AM >To: miha.vrhov...@gmail.com >Cc: golang-nuts <golang-nuts@googlegroups.com> >Subject: Re: [go-nuts] ultra slow os.Exec > >On Tue, Nov 19, 2019 at 6:52 AM <miha.vrhov...@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 golang-nuts+unsubscr...@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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/224130111.2155.1574176929921%40wamui-cheeto.atl.sa.earthlink.net.