5b7dcb3005
Fixes https://git.lix.systems/lix-project/lix/issues/268 Change-Id: I3f1b0ddf064f891cca8b53229c5c31c74cea3d9f
16 lines
409 B
Nix
16 lines
409 B
Nix
{ lib, runCommand, shouldBePresent ? false }:
|
|
|
|
runCommand "core-dump-now" { } ''
|
|
set -m
|
|
sleep infinity &
|
|
|
|
# make a coredump
|
|
kill -SIGSEGV %1
|
|
|
|
if ${lib.optionalString (shouldBePresent) "!"} test -n "$(find . -maxdepth 1 -name 'core*' -print -quit)"; then
|
|
echo "core file was in wrong presence state, expected: ${if shouldBePresent then "present" else "missing"}"
|
|
exit 1
|
|
fi
|
|
|
|
touch $out
|
|
''
|