Skip to content

Commit 3cffaed

Browse files
committed
1 parent cd00aae commit 3cffaed

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

spec/mspec/lib/mspec/helpers/tmp.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,20 @@
3636
end
3737

3838
def tmp(name, uniquify = true)
39-
mkdir_p SPEC_TEMP_DIR unless Dir.exist? SPEC_TEMP_DIR
39+
if Dir.exist? SPEC_TEMP_DIR
40+
stat = File.stat(SPEC_TEMP_DIR)
41+
if stat.world_writable? and !stat.sticky?
42+
raise ArgumentError, "SPEC_TEMP_DIR (#{SPEC_TEMP_DIR}) is world writable but not sticky"
43+
end
44+
else
45+
platform_is_not :windows do
46+
umask = File.umask
47+
if (umask & 0002) == 0 # o+w
48+
raise ArgumentError, "File.umask #=> #{umask.to_s(8)} (world-writable)"
49+
end
50+
end
51+
mkdir_p SPEC_TEMP_DIR
52+
end
4053

4154
if uniquify and !name.empty?
4255
slash = name.rindex "/"

spec/mspec/lib/mspec/runner/formatters/multi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ def aggregate_results(files)
4242
end
4343

4444
def print_exception(exc, count)
45-
print "\n#{count})\n#{exc}\n"
45+
@err.print "\n#{count})\n#{exc}\n"
4646
end
4747
end

0 commit comments

Comments
 (0)