bin/cargo-flow-check 422 B raw
1
#!/bin/sh
2
3
# Shift process name parameter out.
4
shift
5
6
tmpfile=$(mktemp /tmp/cargo-flow.XXXXXX)
7
result="$(cargo $@ --color always 2>&1)"
8
9
if [ "$?" -ne 0 ]; then
10
	# Display the results, but also output them to `errors.err`, which vim
11
	# can read, after stripping any ANSI escape sequences.
12
	echo -n "$result" | tee $tmpfile
13
	sed -r 's/\x1b\[[0-9;]*m?//g' $tmpfile > errors.err
14
else
15
	echo "$result"
16
	echo -n > errors.err
17
fi