Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1638)

Delta Between Two Patch Sets: src/pkg/exec/lp_unix.go

Issue 4607052: code review 4607052: os.Error API: don't export os.ErrorString, use os.NewEr... (Closed)
Left Patch Set: Created 13 years, 9 months ago
Right Patch Set: diff -r 6e3e06fb2dc3 https://go.googlecode.com/hg/ Created 13 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/exec/lp_plan9.go ('k') | src/pkg/exec/lp_windows.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package exec 5 package exec
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 "strings" 9 "strings"
10 ) 10 )
11 11
12 // ErrNotFound is the error resulting if a path search failed to find an executa ble file. 12 // ErrNotFound is the error resulting if a path search failed to find an executa ble file.
13 var ErrNotFound = os.ErrorString("executable file not found in $PATH") 13 var ErrNotFound = os.NewError("executable file not found in $PATH")
14 14
15 func findExecutable(file string) os.Error { 15 func findExecutable(file string) os.Error {
16 d, err := os.Stat(file) 16 d, err := os.Stat(file)
17 if err != nil { 17 if err != nil {
18 return err 18 return err
19 } 19 }
20 if d.IsRegular() && d.Permission()&0111 != 0 { 20 if d.IsRegular() && d.Permission()&0111 != 0 {
21 return nil 21 return nil
22 } 22 }
23 return os.EPERM 23 return os.EPERM
(...skipping 19 matching lines...) Expand all
43 if dir == "" { 43 if dir == "" {
44 // Unix shell semantics: path element "" means "." 44 // Unix shell semantics: path element "" means "."
45 dir = "." 45 dir = "."
46 } 46 }
47 if err := findExecutable(dir + "/" + file); err == nil { 47 if err := findExecutable(dir + "/" + file); err == nil {
48 return dir + "/" + file, nil 48 return dir + "/" + file, nil
49 } 49 }
50 } 50 }
51 return "", &Error{file, ErrNotFound} 51 return "", &Error{file, ErrNotFound}
52 } 52 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b