Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Observr script for comiling a Rust project and running tests when files are saved.
require 'open3'
def test
puts
puts '========================================='
puts
_, stdout, wait_thr = Open3.popen2('cargo test -- --nocapture --test-threads=1')
print stdout.getc until stdout.eof?
wait_thr.value.success?
end
def build
puts
puts '========================================='
puts
_, stdout, wait_thr = Open3.popen2('cargo build')
print stdout.getc until stdout.eof?
wait_thr.value.success?
end
def bench
puts
puts '========================================='
puts
_, stdout, wait_thr = Open3.popen2('cargo bench -- --nocapture')
print stdout.getc until stdout.eof?
wait_thr.value.success?
end
watch('^src/.*') { test && build }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.