diff --git a/npm/index.js b/npm/index.js index 2957a6b8..bed7bdf8 100644 --- a/npm/index.js +++ b/npm/index.js @@ -272,8 +272,12 @@ async function read(fd = 0) { } function isFile(fs, path) { - const stat = fs.statSync(path, {throwIfNoEntry: false}) - return stat !== undefined && stat.isFile() + try { + const stat = fs.statSync(path, {throwIfNoEntry: false}) + return stat !== undefined && stat.isFile() + } catch (err) { + return false + } } function sleepSync(ms) { diff --git a/npm/test.js b/npm/test.js index bf096b5f..686b158e 100644 --- a/npm/test.js +++ b/npm/test.js @@ -221,4 +221,10 @@ void async function main() { const {stdout} = await runNoPipe(`.name package.json`) t.equal(stdout, 'fx\n') }) + + await test('cli - very large arg', async t => { + const {status, stderr, stdout} = await run(42, `'x => x /* dsasdfaskjdfhaskldjfhgaslkdjfhasdlkfjhasdlkfjhasdlfkjhasdflkjasdhflkjasdhflacnskdcfhalsdkfjhasldkfjhcasdlckfajhdsflbkasjdhfclnaskdjhfalskdfgjhsdflkfjhasdlfkahjsdflkasjhdflkafdggrhdfggsdfghsdghadfgsdfgsdfglhadshfglaksjdfhalskjdfhasldkfjhaldfkjhasdlfkjhasdflkjhadflkhasdlkfjhdfkhjasdlfkjhasdflkhaflkcansdfhvlkvajhfgvbalergtcqwaleifhavslbkfchasdblkfhldsfhasdfasfasdfdfdddddddadlakfjhas */'`) + t.equal(status, 0, stderr) + t.equal(stdout, '42\n') + }) }()