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.

Reply via email to