]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: terminate error string in exec package on Plan 9
authorRob Pike <r@golang.org>
Thu, 20 Feb 2014 01:17:36 +0000 (17:17 -0800)
committerRob Pike <r@golang.org>
Thu, 20 Feb 2014 01:17:36 +0000 (17:17 -0800)
Try to prevent messages like this:
        './pack' file does not exist����������������������������������������������������������������������������������������������������
TBR=adonovan

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/66270043

src/pkg/syscall/exec_plan9.go

index 99ad2f15887f5622b8f213432aad4f2ee7d14f27..45ee542bb09dc4179a299202911fb8c8f9259d41 100644 (file)
@@ -486,7 +486,7 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
 
        if err != nil || n != 0 {
                if n != 0 {
-                       err = NewError(string(errbuf[:]))
+                       err = NewError(string(errbuf[:n]))
                }
 
                // Child failed; wait for it to exit, to make sure