Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crystal next support #72

Merged
merged 2 commits into from
Dec 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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