サンプル
cross-spawn 7.0.6: cross-spawn
検証済みサンプル — npm cross-spawn 7.0.6: cross-spawn. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: crossSpawn.sync executes command synchronously and…
sha256:16485ebfe716dd75c9e7351ada1212ac6dff8035da0898f4479e291a67474c32
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 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-26 |
ケース
HOW- ゴール
- verify cross-spawn in pkg:npm/cross-spawn@7.0.6
- パッケージ
- シンボル
-
- cross-spawn
- 作成日
- 2026-08-26T10:41:56Z
コントラクト
- crossSpawn.sync executes command synchronously and returns status 0 with valid pid
- crossSpawn.sync decodes stdout and stderr as strings when encoding option is provided
- crossSpawn.sync passes arguments and custom environment variables to child process
- crossSpawn.sync captures non-zero exit code and standard error on failure
- crossSpawn.sync reports ENOENT error when binary does not exist
- crossSpawn executes command asynchronously and streams stdout
- crossSpawn pipes stdin to child process
- crossSpawn emits error event with ENOENT for non-existent command
ファイル
- 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 cross-spawn in pkg:npm/cross-spawn@7.0.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/cross-spawn@7.0.6
Demonstrate these symbols/APIs:
- cross-spawn
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:1cc8daf8fd9f26210030a336410d0a881e5ccfbc52d25b7800d5643cc87cb74f","contract":["crossSpawn.sync executes command synchronously and returns status 0 with valid pid","crossSpawn.sync decodes stdout and stderr as strings when encoding option is provided","crossSpawn.sync passes arguments and custom environment variables to child process","crossSpawn.sync captures non-zero exit code and standard error on failure","crossSpawn.sync reports ENOENT error when binary does not exist","crossSpawn executes command asynchronously and streams stdout","crossSpawn pipes stdin to child process","crossSpawn emits error event with ENOENT for non-existent command"],"goal":"verify cross-spawn in pkg:npm/cross-spawn@7.0.6","kind":"HOW","packages":["pkg:npm/cross-spawn@7.0.6"],"schemaVersion":1,"symbols":["cross-spawn"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/cross-spawn@7.0.6"],"schemaVersion":1,"subject":"pkg:npm/cross-spawn@7.0.6","symbols":["cross-spawn"],"verifierAdapter":"node-typescript@1"}
{
"name": "cross-spawn-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cross-spawn-verification",
"version": "1.0.0",
"dependencies": {
"cross-spawn": "7.0.6"
}
},
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"license": "ISC"
},
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
}
}
}
{
"name": "cross-spawn-verification",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"cross-spawn": "7.0.6"
}
}
{
"schemaVersion": 1,
"goal": "verify cross-spawn in pkg:npm/cross-spawn@7.0.6",
"kind": "HOW",
"packages": [
"pkg:npm/cross-spawn@7.0.6"
],
"symbols": [
"cross-spawn"
]
}
import assert from 'node:assert';
import spawn from 'cross-spawn';
// 1. crossSpawn.sync executes command synchronously and returns status 0 with valid pid
const resultSync = spawn.sync('node', ['-e', 'console.log("hello cross-spawn")']);
assert.strictEqual(resultSync.status, 0);
assert.strictEqual(resultSync.signal, null);
assert.strictEqual(resultSync.error, null);
assert.ok(typeof resultSync.pid === 'number' && resultSync.pid > 0);
assert.ok(resultSync.stdout.toString().includes('hello cross-spawn'));
// 2. crossSpawn.sync decodes stdout and stderr as strings when encoding option is provided
const resultEncoded = spawn.sync('node', ['-e', 'console.log("encoded-output")'], {
encoding: 'utf8'
});
assert.strictEqual(resultEncoded.status, 0);
assert.strictEqual(resultEncoded.stdout.trim(), 'encoded-output');
assert.strictEqual(resultEncoded.stderr, '');
// 3. crossSpawn.sync passes arguments and custom environment variables to child process
const resultEnv = spawn.sync('node', ['-e', 'console.log(process.env.TEST_VAR, process.argv[1])', 'arg1'], {
encoding: 'utf8',
env: { ...process.env, TEST_VAR: 'custom_value' }
});
assert.strictEqual(resultEnv.status, 0);
assert.ok(resultEnv.stdout.includes('custom_value arg1'));
// 4. crossSpawn.sync captures non-zero exit code and standard error on failure
const resultFail = spawn.sync('node', ['-e', 'console.error("error occurred"); process.exit(42)'], {
encoding: 'utf8'
});
assert.strictEqual(resultFail.status, 42);
assert.ok(resultFail.stderr.includes('error occurred'));
// 5. crossSpawn.sync reports ENOENT error when binary does not exist
const resultEnoent = spawn.sync('non_existent_command_123456_xyz', ['--test']);
assert.ok(resultEnoent.error !== null && resultEnoent.error !== undefined);
assert.strictEqual(resultEnoent.error.code, 'ENOENT');
// 6. crossSpawn executes command asynchronously and streams stdout
const child = spawn('node', ['-e', 'console.log("async output")']);
let stdoutData = '';
child.stdout.on('data', (chunk) => {
stdoutData += chunk.toString();
});
const [exitCode] = await new Promise((resolve) => {
child.on('close', (code, signal) => {
resolve([code, signal]);
});
});
assert.strictEqual(exitCode, 0);
assert.ok(stdoutData.includes('async output'));
// 7. crossSpawn pipes stdin to child process
const childStdin = spawn('node', ['-e', 'process.stdin.pipe(process.stdout)']);
let pipedOutput = '';
childStdin.stdout.on('data', (chunk) => {
pipedOutput += chunk.toString();
});
childStdin.stdin.write('piped-input-data\n');
childStdin.stdin.end();
const [stdinExitCode] = await new Promise((resolve) => {
childStdin.on('close', (code) => {
resolve([code]);
});
});
assert.strictEqual(stdinExitCode, 0);
assert.strictEqual(pipedOutput.trim(), 'piped-input-data');
// 8. crossSpawn emits error event with ENOENT for non-existent command
const childMissing = spawn('non_existent_binary_xyz_123456', ['--arg']);
const missingError = await new Promise((resolve) => {
childMissing.on('error', (err) => {
resolve(err);
});
});
assert.ok(missingError !== null);
assert.strictEqual(missingError.code, 'ENOENT');
console.log('Contract passed');
オリジンシーダー
匿名