Skip to content

Commit

Permalink
Crystal next support (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
veelenga authored Dec 27, 2017
1 parent a485e5e commit 6dabbef
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@

/bin/icr
src/bin

.icr.*.cr
2 changes: 1 addition & 1 deletion spec/integration/icr_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/icr.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "readline"
require "tempfile"
require "io/memory"
require "secure_random"
require "random/secure"
require "colorize"

require "compiler/crystal/syntax"
Expand Down
4 changes: 2 additions & 2 deletions src/icr/executer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 6dabbef

Please sign in to comment.