diff --git a/.gitignore b/.gitignore index b53ea81..bf7cc27 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /bin/icr src/bin + +.icr.*.cr diff --git a/spec/integration/icr_spec.cr b/spec/integration/icr_spec.cr index d324265..77142fe 100644 --- a/spec/integration/icr_spec.cr +++ b/spec/integration/icr_spec.cr @@ -358,7 +358,7 @@ describe "icr command" do icr("v__ = 0").should match /0/ icr("v__1 = 0").should match /0/ icr("filename = \"spec__helper.cr\"").should match /spec__helper.cr/ - icr("require \"secure_random\"").should match /ok/ + icr("require \"random/secure\"").should match /ok/ end it "highlights input code" do diff --git a/src/icr.cr b/src/icr.cr index c5a76a3..7e80e49 100644 --- a/src/icr.cr +++ b/src/icr.cr @@ -1,7 +1,7 @@ require "readline" require "tempfile" require "io/memory" -require "secure_random" +require "random/secure" require "colorize" require "compiler/crystal/syntax" diff --git a/src/icr/executer.cr b/src/icr/executer.cr index e9bcba6..d9c331b 100644 --- a/src/icr/executer.cr +++ b/src/icr/executer.cr @@ -8,7 +8,7 @@ module Icr # Temporary file where generated source code is written # NOTE: File is created in the current dir, in order to be able to # require local files. - @tmp_file_name = ".icr_#{SecureRandom.urlsafe_base64}.cr" + @tmp_file_name = ".icr_#{Random::Secure.urlsafe_base64}.cr" @tmp_file_path = File.join(Dir.current, @tmp_file_name) # Accumulates the output from previous executions, so we can distinguish the @@ -21,7 +21,7 @@ module Icr io_out = IO::Memory.new io_error = IO::Memory.new command = "#{CRYSTAL_COMMAND} #{@tmp_file_path} --no-debug" - status = Process.run(command, nil, nil, false, true, nil, io_out, io_error) + status = Process.run(command, shell: true, output: io_out, error: io_error) print_source_file if @debug File.delete(@tmp_file_path)