Skip to content

Commit f387291

Browse files
authored
Improve collect error messages (#4)
1 parent 335727a commit f387291

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

collect

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ perf_version=$(perf --version)
207207
process_opts "$@"
208208
find_compressor
209209

210+
# Check if running as root
211+
if [ "$(id -u)" -ne 0 ]; then
212+
die "This script must be run as root."
213+
fi
214+
215+
# Check if perf is available
216+
if ! which perf >/dev/null 2>&1; then
217+
die "The 'perf' command is not found in PATH."
218+
fi
219+
210220
# Specific to Cisco IOS-XR: disable memdbg if present, since otherwise it can
211221
# cause perf to coredump.
212222
if [ "$LD_PRELOAD" = "/pkg/lib/libmemdbg.so" ]; then

0 commit comments

Comments
 (0)