mirror of
https://github.com/kanaka/mal.git
synced 2024-11-13 11:23:59 +03:00
c9de2e82ed
- tests/docker/Dockerfile: specifies full docker image containing all tools/languages (except matlab). - tests/docker-build.sh: build above image. - tests/docker-run.sh: launch above image. Example: ./tests/docker-run.sh make test^js^step2 - Various fixes across multiple languages: - Unicode fixes for bash and R on Ubuntu Utopic - readline history fixes for when ~/.mal-history is not available or readable/writable. No fatal errors. - fixes to work with perl 5.20 (and still perl 5.18)
23 lines
548 B
Ruby
23 lines
548 B
Ruby
require "readline"
|
|
|
|
$history_loaded = false
|
|
$histfile = "#{ENV['HOME']}/.mal-history"
|
|
|
|
def _readline(prompt)
|
|
if !$history_loaded && File.exist?($histfile)
|
|
$history_loaded = true
|
|
if File.readable?($histfile)
|
|
File.readlines($histfile).each {|l| Readline::HISTORY.push(l.chomp)}
|
|
end
|
|
end
|
|
|
|
if line = Readline.readline(prompt, true)
|
|
if File.writable?($histfile)
|
|
File.open($histfile, 'a+') {|f| f.write(line+"\n")}
|
|
end
|
|
return line
|
|
else
|
|
return nil
|
|
end
|
|
end
|