Created
March 14, 2024 09:21
-
-
Save HDegroote/8db6ecad01410123bdbffd846c33901c to your computer and use it in GitHub Desktop.
Bare crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Node works as expected: | |
node index.js # Prints help and exits with 1 status ('done' never printed) | |
node index.js parse # prints 'done', 0 status | |
Bare works fine with the parse command: | |
./node_modules/bare-runtime/bin/bare ./index.js # prints 'done', 0 status code | |
But fails on: | |
./node_modules/bare-runtime/bin/bare ./index.js | |
(exits with 1 status code instead of printing the help, sometimes printing obscure errors) | |
Example error: | |
./node_modules/bare-runtime/bin/bare ./index.js | |
top scope | |
main scope | |
parsing | |
<--- Last few GCs ---> | |
[13379:0x5b769bbcc210] 114419246000 ms: Mark-Compact (reduce) 2.1 (6.6) -> 2.1 (3.3) MB, 4.77 / 0.00 ms (average mu = 0.880, current mu = 0.008) external memory pressure; GC in old space requested | |
[13379:0x5b769bbcc210] 116719180000 ms: Mark-Compact (reduce) 2.1 (3.3) -> 2.1 (3.3) MB, 2.27 / 0.00 ms (average mu = 0.817, current mu = 0.012) external memory pressure; GC in old space requested | |
<--- JS stacktrace ---> | |
# | |
# Fatal JavaScript out of memory: JSTypedArray::GetBuffer | |
# | |
*/ | |
const { program } = require('commander') | |
const process = require('process') | |
console.log('top scope') | |
async function main () { | |
console.log('main scope') | |
program.name('breaker').description('CLI') | |
program.command('parse') | |
console.log('parsing') | |
await program.parseAsync(process.argv) | |
console.log('done') | |
} | |
main().catch(e => console.error('caught an error;', e)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "cli", | |
"main": "index.js", | |
"pear": { | |
"name": "cli", | |
"type": "terminal" | |
}, | |
"license": "Apache-2.0", | |
"devDependencies": { | |
"bare-runtime": "^1.0.4", | |
"brittle": "^3.0.0", | |
"standard": "^17.1.0" | |
}, | |
"scripts": { | |
"dev": "pear dev", | |
"test": "standard" | |
}, | |
"dependencies": { | |
"child_process": "npm:bare-node-child-process", | |
"commander": "^12.0.0", | |
"events": "npm:bare-node-events", | |
"path": "npm:bare-node-path", | |
"fs": "npm:bare-node-fs", | |
"process": "npm:bare-node-process" | |
}, | |
"optionalDependencies": { | |
"bare-events": "^2.2.1", | |
"bare-path": "^2.1.0", | |
"bare-subprocess": "^2.0.4", | |
"bare-process": "^1.3.0", | |
"bare-fs": "^2.1.5" | |
}, | |
"imports": { | |
"events": { | |
"bare": "bare-events", | |
"default": "events" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment