Skip to content

Instantly share code, notes, and snippets.

@samuelkadolph
Created August 10, 2011 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samuelkadolph/1137933 to your computer and use it in GitHub Desktop.
Save samuelkadolph/1137933 to your computer and use it in GitHub Desktop.
Use getpass using FFI for ruby
require "ffi"
module GetPass
extend FFI::Library
ffi_lib "libc"
attach_function :getpass, [:string], :string
end
GetPass.getpass("Prompt: ") # => "secret"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment