샘플
signal-exit 3.0.7
검증된 샘플 — npm signal-exit 3.0.7. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: onExit registers an exit callback and returns an unregister…
sha256:32a1c9e1c6c725b407cff187013015ca086ad67013166b721ad5fb39b27cb5ee
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
케이스
HOW- 목표
- verify pkg:npm/signal-exit@3.0.7
- 환경
- node 22.23.2
- 생성일
- 2026-08-23T13:32:00Z
컨트랙트
- onExit registers an exit callback and returns an unregister function
- calling the returned unregister function prevents the exit callback from firing
- onExit throws AssertionError when a non-function callback is passed
- onExit callback receives the numeric exit code when process.exit is called
- onExit callback receives exit code 0 when the Node.js event loop terminates naturally
- onExit callback receives the signal name when the process receives a termination signal
- onExit with alwaysLast option executes after standard exit listeners
- signals export provides an array of standard POSIX termination signal names
- load and unload functions control the lifecycle of process exit listeners
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/signal-exit@3.0.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/signal-exit@3.0.7
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:1c92273ec54f68150fc27d112b87417f352dffff5dcf9b01b339be09f4668bec","constraints":{"executionContext":"node"},"contract":["onExit registers an exit callback and returns an unregister function","calling the returned unregister function prevents the exit callback from firing","onExit throws AssertionError when a non-function callback is passed","onExit callback receives the numeric exit code when process.exit is called","onExit callback receives exit code 0 when the Node.js event loop terminates naturally","onExit callback receives the signal name when the process receives a termination signal","onExit with alwaysLast option executes after standard exit listeners","signals export provides an array of standard POSIX termination signal names","load and unload functions control the lifecycle of process exit listeners"],"goal":"verify pkg:npm/signal-exit@3.0.7","kind":"HOW","packages":["pkg:npm/signal-exit@3.0.7"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/signal-exit@3.0.7"],"schemaVersion":1,"subject":"pkg:npm/signal-exit@3.0.7","verifierAdapter":"node-typescript@1"}
{
"name": "sample-signal-exit",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-signal-exit",
"version": "1.0.0",
"dependencies": {
"signal-exit": "3.0.7"
}
},
"node_modules/signal-exit": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"license": "ISC"
}
}
}
{
"name": "sample-signal-exit",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"signal-exit": "3.0.7"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/signal-exit@3.0.7",
"kind": "HOW",
"packages": [
"pkg:npm/signal-exit@3.0.7"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { spawn, spawnSync } from 'node:child_process';
import onExit from 'signal-exit';
// 1. onExit registers an exit callback and returns an unregister function
{
const unregister = onExit(() => {});
assert.equal(typeof unregister, 'function');
unregister();
}
// 2. calling the returned unregister function prevents the exit callback from firing
{
const code = `
const onExit = require('signal-exit');
const remove = onExit(() => {
process.stdout.write('UNREGISTER_FAILED');
});
remove();
process.exit(0);
`;
const res = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
assert.equal(res.status, 0);
assert.ok(!res.stdout.includes('UNREGISTER_FAILED'));
}
// 3. onExit throws AssertionError when a non-function callback is passed
{
assert.throws(
() => {
onExit(null);
},
{
name: 'AssertionError',
}
);
}
// 4. onExit callback receives the numeric exit code when process.exit is called
{
const code = `
const fs = require('fs');
const onExit = require('signal-exit');
onExit((code, signal) => {
fs.writeSync(1, 'EXIT_CODE:' + code + ':' + signal);
});
process.exit(42);
`;
const res = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
assert.equal(res.status, 42);
assert.ok(res.stdout.includes('EXIT_CODE:42:null'));
}
// 5. onExit callback receives exit code 0 when the Node.js event loop terminates naturally
{
const code = `
const fs = require('fs');
const onExit = require('signal-exit');
onExit((code, signal) => {
fs.writeSync(1, 'NATURAL_EXIT:' + code + ':' + signal);
});
`;
const res = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
assert.equal(res.status, 0);
assert.ok(res.stdout.includes('NATURAL_EXIT:0:null'));
}
// 6. onExit callback receives the signal name when the process receives a termination signal
await new Promise((resolve, reject) => {
const code = `
const fs = require('fs');
const onExit = require('signal-exit');
onExit((code, signal) => {
fs.writeSync(1, 'SIGNAL:' + signal);
});
setInterval(() => {}, 1000);
`;
const child = spawn(process.execPath, ['-e', code], { stdio: ['pipe', 'pipe', 'inherit'] });
let out = '';
child.stdout.on('data', (d) => {
out += d.toString();
});
setTimeout(() => {
child.kill('SIGTERM');
}, 100);
child.on('close', () => {
try {
assert.ok(out.includes('SIGNAL:SIGTERM'));
resolve();
} catch (err) {
reject(err);
}
});
});
// 7. onExit with alwaysLast option executes after standard exit listeners
{
const code = `
const fs = require('fs');
const onExit = require('signal-exit');
onExit((code, signal) => {
fs.writeSync(1, 'LAST\\n');
}, { alwaysLast: true });
onExit((code, signal) => {
fs.writeSync(1, 'FIRST\\n');
});
process.exit(0);
`;
const res = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
assert.equal(res.status, 0);
assert.equal(res.stdout, 'FIRST\nLAST\n');
}
// 8. signals export provides an array of standard POSIX termination signal names
{
const sigs = onExit.signals();
assert.ok(Array.isArray(sigs));
assert.ok(sigs.includes('SIGINT'));
assert.ok(sigs.includes('SIGTERM'));
assert.ok(sigs.includes('SIGHUP'));
}
// 9. load and unload functions control the lifecycle of process exit listeners
{
assert.equal(typeof onExit.load, 'function');
assert.equal(typeof onExit.unload, 'function');
onExit.load();
onExit.unload();
}
오리진 시더
익명