Skip to content

Instantly share code, notes, and snippets.

@bjfish
Created April 16, 2015 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjfish/013d9e650f9b17799dbf to your computer and use it in GitHub Desktop.
Save bjfish/013d9e650f9b17799dbf to your computer and use it in GitHub Desktop.
Dir.mktmpdir workarounds - you may need to adjust tmp dir path to `echo $TMPDIR`
diff --git a/lib/ruby/stdlib/tmpdir.rb b/lib/ruby/stdlib/tmpdir.rb
index 9ba06d5..5b4b143 100644
--- a/lib/ruby/stdlib/tmpdir.rb
+++ b/lib/ruby/stdlib/tmpdir.rb
@@ -30,11 +30,11 @@ class Dir
for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.']
next if !dir
dir = File.expand_path(dir)
- if stat = File.stat(dir) and stat.directory? and stat.writable? and
- (!(@@using_19 && stat.world_writable?) || stat.sticky?)
- tmp = dir
+ #if stat = File.stat(dir) and stat.directory? and stat.writable? and
+ # (!(@@using_19 && stat.world_writable?) || stat.sticky?)
+ tmp = "/var/folders/vp/52_tfhx14dg7j3zzq7p44bwm0000gn/T/"
break
- end
+ # end
end
unless tmp
diff --git a/truffle/src/main/java/org/jruby/truffle/nodes/core/DirNodes.java b/truffle/src/main/java/org/jruby/truffle/nodes/core/DirNodes.java
index d5af4fd..f1e044d 100644
--- a/truffle/src/main/java/org/jruby/truffle/nodes/core/DirNodes.java
+++ b/truffle/src/main/java/org/jruby/truffle/nodes/core/DirNodes.java
@@ -113,7 +113,7 @@ public abstract class DirNodes {
}
- @CoreMethod(names = "mkdir", needsSelf = false, onSingleton = true, required = 1)
+ @CoreMethod(names = "mkdir", needsSelf = false, onSingleton = true, required = 1, optional = 1)
public abstract static class MkdirNode extends CoreMethodNode {
public MkdirNode(RubyContext context, SourceSection sourceSection) {
@@ -125,7 +125,7 @@ public abstract class DirNodes {
}
@Specialization
- public int mkdir(RubyString path) {
+ public int mkdir(RubyString path, Object value) {
notDesignedForCompilation();
String dir = path.toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment