Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Commit c29fc1e

Browse files
simonbyrnetkelman
authored andcommitted
Add octal prefix (0o) to filemode in StatStruct (JuliaLang#20919)
* Add octal prefix (0o) to filemode in StatStruct Makes it clear it is in octal * add parsing test
1 parent f4d1149 commit c29fc1e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

base/stat.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ StatStruct(buf::Union{Vector{UInt8},Ptr{UInt8}}) = StatStruct(
5757
ccall(:jl_stat_ctime, Float64, (Ptr{UInt8},), buf),
5858
)
5959

60-
show(io::IO, st::StatStruct) = print(io, "StatStruct(mode=$(oct(filemode(st),6)), size=$(filesize(st)))")
60+
show(io::IO, st::StatStruct) = print(io, "StatStruct(mode=0o$(oct(filemode(st),6)), size=$(filesize(st)))")
6161

6262
# stat & lstat functions
6363

test/file.jl

+2
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ c_stat = stat(cfile)
430430
@test a_stat.size == b_stat.size
431431
@test a_stat.size == c_stat.size
432432

433+
@test parse(Int,match(r"mode=(.*),",sprint(show,a_stat)).captures[1]) == a_stat.mode
434+
433435
close(af)
434436
rm(afile)
435437
rm(bfile)

0 commit comments

Comments
 (0)