Skip to content

Commit

Permalink
Merge pull request JuliaLang#9061 from JuliaLang/mn/nocdargs
Browse files Browse the repository at this point in the history
remove extra args from do-block cd() method
  • Loading branch information
JeffBezanson committed Feb 9, 2015
2 parents 8614188 + 7aa7529 commit 93c3a58
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ function cd(dir::AbstractString)
end
cd() = cd(homedir())

@unix_only function cd(f::Function, dir::AbstractString, args...)
@unix_only function cd(f::Function, dir::AbstractString)
fd = ccall(:open,Int32,(Ptr{UInt8},Int32),".",0)
systemerror(:open, fd == -1)
try
cd(dir)
f(args...)
f()
finally
systemerror(:fchdir, ccall(:fchdir,Int32,(Int32,),fd) != 0)
systemerror(:close, ccall(:close,Int32,(Int32,),fd) != 0)
end
end
@windows_only function cd(f::Function, dir::AbstractString, args...)
@windows_only function cd(f::Function, dir::AbstractString)
old = pwd()
try
cd(dir)
f(args...)
f()
finally
cd(old)
end
Expand Down

0 comments on commit 93c3a58

Please sign in to comment.