Giter Site home page Giter Site logo

Comments (6)

postmodern avatar postmodern commented on May 30, 2024

We definitely want ruby-install to support Linux as well as the BSDs. Perhaps a broader solution would be to detect if we are in a BSD environment vs. a GNU one?

from ruby-install.

paul avatar paul commented on May 30, 2024

I don't think we can detect platform, since I am using OSX but installed the GNU coreutils from homebrew and added them to my default path because I prefer them for day-to-day things. Similar to the issue I linked, I think the best way would be to detect which option flag stat will understand:

if stat -c"%U" /dev/null >/dev/null 2>/dev/null ; then 
  # GNU stat
else
  # BSD stat
fi

Probably should just add this to the other conditionals like for auto-detecting the package manager. I'm not that familiar with low-level linux/bsd/posix things like this though, isn't there a better cross-platform way to determine the owner of a file? (As I ask that, I did some googling. Seems the only choices are stat or ls -ld | awk or perl. Ew.)

from ruby-install.

postmodern avatar postmodern commented on May 30, 2024

Since we only call stat when dealing with homebrew on OSX, perhaps we could call /bin/stat instead?

from ruby-install.

paul avatar paul commented on May 30, 2024

If that's the case, then yeah, that's probably the easiest and best solution.

from ruby-install.

havenwood avatar havenwood commented on May 30, 2024

Looks like system stat at /usr/bin/stat should indeed do the trick.

from ruby-install.

postmodern avatar postmodern commented on May 30, 2024

Fixed back in 0.3.1.

from ruby-install.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.