如何在每次保存时使用entr自动编译并运行测试Rust文件?我试过了
ls test.rs | entr -c "rustc test.rs && ./test"
但它给出了错误:
entr: exec rustc test.rs && ./test: No such file or directory
你需要-s
参数,它使用你的shell来评估命令:
-s Evaluate the first argument using the interpreter specified by the SHELL environment variable. When this flag is set, the name of the shell and exit code is printed after each invocation.
正确的命令是:
ls test.rs | entr -cs "rustc test.rs && ./test"
作为奖励,它还会打印每个调用的退出代码!
Hello World!
zsh returned exit code 0