Crystal lang : execute shell command

Phil Girard
1 min readJan 2, 2018

--

To execute shell command with Crystal use the system function.

puts "START"fork do
system "echo 'HELLO'"
end
puts "END"# This program prints the following :
# > START
# > END
# > HELLO

Fork creates a new system thread to execute the command to deal with the fact that system is a blocking statement.

The system command in crystal works a lot like the system command in ruby.

Buy me a coffee

If you find this article useful consider buying me a coffee :) This helps me publish more useful content!

Sign up to discover human stories that deepen your understanding of the world.

--

--

Phil Girard
Phil Girard

Responses (1)

What are your thoughts?