const { constants } = require("os");
function describeExit(result) {
if (typeof result.status === "number") {
return { code: result.status, note: null };
}
const signal = result.signal;
if (!signal) {
return {
code: 1,
note:
"sessionwiki: the binary ended without an exit code and without a signal. " +
"Exiting 1, but that 1 is this launcher's, not the binary's.",
};
}
const number = constants.signals[signal];
return {
code: number ? 128 + number : 1,
note:
`sessionwiki: the binary was killed by ${signal}. Something on this machine ` +
"sent that signal - this is not sessionwiki exiting on its own.",
};
}
module.exports = { describeExit };