Git Product home page Git Product logo

crun's Issues

Error deleting file *.lock

Description

I want to process some text stream with my program (the same program) as in :

echo "hello\nworld\n" | ./myprog.cr  process-lines | ./myprog.cr  process-columns

When using the crystal compiler like in #! usr/bin/env crystal I got an error so following a issue
I found crun. From the description I think it should handle my case but when using it
I found the following error :

Unhandled exception: Error deleting file '/home/ nieto/.cache/crun/writter.crystal.lock': No such file or directory (Errno)
Failed to raise an exception: END_OF_STACK
[0x55c92d246da6] ???
[0x55c92d201afb] __crystal_raise +43
[0x55c92d202af5] ???
[0x55c92d20b131] ???
[0x55c92d2067ac] ???
[0x55c92d205bff] ???
[0x55c92d21f46d] ???
[0x55c92d21d9a5] ???
[0x55c92d20429a] main +74
[0x7f8f791e309b] __libc_start_main +235
[0x55c92d20087a] _start +42
[0x0] ???
minimal program
#!/usr/bin/env crun

while line = gets 
  puts line
end 

or

#!/usr/bin/env crun 
sleep 1

Support to build from string

Example – Simple usage:

crun eval 'puts ARGV' -- 1 2 3

Example – Run crun with Kakoune:

$ crun eval %{
  # ---
  # kakoune:
  #   github: alexherbo2/kakoune.cr
  # ---
  require "kakoune"

  ...
} -- %val{session} %val{client}

Support to build from STDIN

Example – Run crun with Kakoune:

evaluate-commands %sh{
  crun <<-'EOF'
    # ---
    # kakoune:
    #   github: alexherbo2/kakoune.cr
    # ---
    require "kakoune"

    ...
EOF
}

Linux binfmt support fails because of cached compiled file ending with a .cr extension

Thanks for this project.

In current master build_path is set to

@@build_path ||= "#{build_dir}/#{SOURCE_FILENAME}"

This means that build_path is likely to end with a .cr extension. In case binfmt support for .cr file has been enabled, crun will be called again when the cached compiled file is run

Process.exec(build_path, ARGS)

Adding an extra extension to ensure that cached compiled file does not end with a .cr extension should fix the problem

@@build_path ||= "#{build_dir}/#{SOURCE_FILENAME}.crystal"

perf when running an already built script

I think it should be safe to not call shards install if there's already a lockfile. This saves a lot of time, especially if the network is slow.

diff --git a/src/build.cr b/src/build.cr
index 146acd3..448650b 100644
--- a/src/build.cr
+++ b/src/build.cr
@@ -20,7 +20,8 @@ module Crun
     hash = Dir.cd(build_dir) do
       if shards_yaml
         build_shards_config
-        hash = build_subprocess("shards", %w[install])
+        hash =
+          build_subprocess("shards", %w[install]) unless File.exists? "#{build_dir}/shards.lock"
       end
 
       hash || build_subprocess("crystal", ["build", "-o", build_path, SOURCE])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.