Skip to content

Commit c598eaa

Browse files
committed
Fix return code
1 parent 8f8e737 commit c598eaa

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

examples/authorize_and_store_papi.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ const HTTP_IPFS_API = 'http://127.0.0.1:8080' // Local IPFS HTTP gateway
1818
async function main() {
1919
await cryptoWaitReady();
2020

21-
let client;
22-
21+
let client, resultCode;
2322
try {
2423
client = createClient(getWsProvider(NODE_WS));
2524

@@ -55,13 +54,13 @@ async function main() {
5554
'❌ dataToStore does not match downloadedContent!'
5655
);
5756
console.log(`✅ Verified content - test passed!`);
57+
resultCode = 0;
5858
} catch (error) {
5959
console.error("❌ Error:", error);
60-
process.exit(1);
60+
resultCode = 1;
6161
} finally {
62-
// Cleanup
6362
if (client) client.destroy();
64-
process.exit(0);
63+
process.exit(resultCode);
6564
}
6665
}
6766

examples/authorize_and_store_papi_smoldot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ async function createSmoldotClient() {
5858
async function main() {
5959
await cryptoWaitReady();
6060

61-
let sd, client;
62-
61+
let sd, client, resultCode;
6362
try {
6463
({ client, sd } = await createSmoldotClient());
6564
console.log(`⏭️ Waiting ${SYNC_WAIT_SEC} seconds for smoldot to sync...`);
@@ -97,13 +96,14 @@ async function main() {
9796
'❌ dataToStore does not match downloadedContent!'
9897
);
9998
console.log(`✅ Verified content - test passed!`);
99+
resultCode = 0;
100100
} catch (error) {
101101
console.error("❌ Error:", error);
102-
process.exit(1);
102+
resultCode = 1;
103103
} finally {
104104
if (client) client.destroy();
105105
if (sd) sd.terminate();
106-
process.exit(0);
106+
process.exit(resultCode);
107107
}
108108
}
109109

0 commit comments

Comments
 (0)