Skip to content

Instantly share code, notes, and snippets.

@alopatindev
Last active February 19, 2016 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alopatindev/ac50981f12956792bb6c to your computer and use it in GitHub Desktop.
Save alopatindev/ac50981f12956792bb6c to your computer and use it in GitHub Desktop.
Filtered cargo + inotifywait
#!/bin/bash
# pip2 install toml
# wget https://raw.githubusercontent.com/rust-lang/rust/master/src/etc/ctags.rust -O ~/.config/ctags.rust
SRCDIR=src
RUSTFLAGS="-C target-cpu=core-avx2"
#PROJECT="${PWD##*/}"
PROJECT=$(python2 -c 'import toml; print toml.loads(file("Cargo.toml").read())["package"]["name"]')
exec 2>&1
while inotifywait -r -s -qq -e close_write "${SRCDIR}"
do
echo
echo
(
cargo test --color always -- --color always 2>>/dev/stdout &&
# cargo test --color always -- --color always --ignored 2>>/dev/stdout &&
cargo rustc --color always -- --color always $RUSTFLAGS 2>> /dev/stdout &&
ctags -f tags --options="$HOME/.config/ctags.rust" --recurse "${SRCDIR}" &&
rust-gdb -q -ex 'set environment RUST_BACKTRACE=1' -ex r -ex q "target/debug/${PROJECT}"
) | egrep -v '(Could not compile |To learn more, run the command again with|^$)'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment