run
Version, currently 0.8.321 versions
- 0.8.3latestMar 21, 2017
- 0.8.2not indexedMar 21, 2017
- 0.8.1not indexedMar 21, 2017
- 0.8.0not indexedMar 21, 2017
- 0.7.0not indexedMar 21, 2017
- 0.6.0not indexedMar 21, 2017
- 0.5.2not indexedMar 21, 2017
- 0.5.1not indexedMar 21, 2017
- 0.5.0not indexedMar 21, 2017
- 0.5.0.2not indexedMar 21, 2017
- 0.5.0.1not indexedMar 21, 2017
- 0.4.1not indexedMar 21, 2017
- 0.4.0not indexedMar 21, 2017
- 0.4.0.5not indexedMar 21, 2017
- 0.4.0.4not indexedMar 21, 2017
- 0.4.0.3not indexedMar 21, 2017
- 0.4.0.2not indexedMar 21, 2017
- 0.4.0.1not indexedMar 21, 2017
- 0.3.0not indexedMar 21, 2017
- 0.2.0not indexedMar 21, 2017
- 0.1.0not indexedMar 21, 2017
github.com/mosop/run
A Crystal library for running commands in reusable contexts.
10 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
run:
github: mosop/run
version: ~> 0.8.3Then run:
shards installshard.yml
- Crystal
0.21.0- License
- MIT
- Author
- mosop
Dependencies
Runtime Dependencies
- attempt~> 0.1.0github: mosop/attempt
- crystal_plus~> 0.1.2github: mosop/crystal_plus
Development Dependencies
- stdio~> 0.1.3github: mosop/stdiodev
README
Crystal Run
A Crystal library for running commands in reusable contexts.
Installation
Add this to your application's shard.yml:
dependencies:
run:
github: mosop/run
Code Samples
Smiley
cmd = Run::Command.new("echo", [":)"])
cmd.run.wait # prints ":)"
Additional Arguments
cmd = Run.command("echo", [":)"])
%w(hello goodbye).each do |i|
cmd.run(args: [i]).wait
end
This prints:
:) hello
:) goodbye
Over and Over
cmd = Run.command("echo", [":)"])
100.times do
cmd.run.wait
end
This prints 100 of :).
Multiple at Once
cg = Run.group
100.times do
cg.command "echo", [":)"]
end
cg.run.wait
This prints 100 of :) too.
Nested Contexts
cg = Run.group(chdir: "path")
cg.command "pwd"
cg.command "pwd", chdir: "to"
cg.command "pwd", chdir: ".."
cg.run.wait
If the current directory is /Users/mosop, this code prints:
/Users/mosop/path
/Users/mosop/path/to
/Users/mosop
Parallel
cg = Run.group
cg.command "wget", %w(http://mosop.rocks)
cg.command "wget", %w(http://mosop.yoga)
cg.command "wget", %w(http://mosop.ninja)
process_group = cg.run(parallel: true)
# do other things
process_group.wait
Running Code Blocks
- In a fiber
cg = Run.group
100.times do
cg.future do
puts ":)"
0
end
end
cg.run.wait
- In a forked process
cg = Run.group
100.times do
cg.fork do
puts ":)"
0
end
end
cg.run.wait
Returning Data by Forked Processes
cg = Run.group
100.times do
cg.fork do
Run::ExitStatus.new(0, ":)").exit!
0
end
end
cg.run.wait do |process|
if process = process.as?(Run::AsProcess)
puts process.exit_status.data
end
end
This prints 100 of :).
Usage
require "run"
And see:
Versioning Policy
See Wiki.
Release Notes
See Releases.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.8.3- Tagged
- Mar 21, 2017
- Commit
257e490d9e3b- Crystal
0.21.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/mosop/run
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 26, 2026
- Synced
- Sep 26, 2026
- Versions
- 21