Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
12befd06
Commit
12befd06
authored
Aug 03, 2010
by
Peter Mundy
Committed by
Russ Cox
Aug 03, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os: Null device
R=rsc, cw CC=golang-dev
https://golang.org/cl/1854042
parent
311973ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
exec.go
src/pkg/exec/exec.go
+1
-1
file_unix.go
src/pkg/os/file_unix.go
+4
-0
file_windows.go
src/pkg/os/file_windows.go
+2
-0
No files found.
src/pkg/exec/exec.go
View file @
12befd06
...
...
@@ -39,7 +39,7 @@ func modeToFiles(mode, fd int) (*os.File, *os.File, os.Error) {
if
fd
==
0
{
rw
=
os
.
O_RDONLY
}
f
,
err
:=
os
.
Open
(
"/dev/null"
,
rw
,
0
)
f
,
err
:=
os
.
Open
(
os
.
DevNull
,
rw
,
0
)
return
f
,
nil
,
err
case
PassThrough
:
switch
fd
{
...
...
src/pkg/os/file_unix.go
View file @
12befd06
...
...
@@ -18,6 +18,10 @@ type dirInfo struct {
bufp
int
// location of next record in buf.
}
// DevNull is the name of the operating system's ``null device.''
// On Unix-like systems, it is "/dev/null"; on Windows, "NUL".
const
DevNull
=
"/dev/null"
// Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.)
// if applicable. If successful, methods on the returned File can be used for I/O.
// It returns the File and an Error, if any.
...
...
src/pkg/os/file_windows.go
View file @
12befd06
...
...
@@ -17,6 +17,8 @@ type dirInfo struct {
usefirststat
bool
}
const
DevNull
=
"NUL"
func
(
file
*
File
)
isdir
()
bool
{
return
file
!=
nil
&&
file
.
dirinfo
!=
nil
}
func
openFile
(
name
string
,
flag
int
,
perm
int
)
(
file
*
File
,
err
Error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment