Skip to content
Myr

invalid-stdio-file.js

This file

Path

test/fixtures/invalid-stdio-file.js

10 lines · 359 bytes · JavaScript

Last changed by

Fix an uncaught error when a file target cannot be opened and the subprocess fails to spawnSindre Sorhusbefore adoption1cee524

History of this file

Take it

Fix an uncaught error when a file target cannot be opened and the subprocess fails to spawnSindre Sorhusbefore adoption1cee524

lines 1–10why, one step back
1#!/usr/bin/env node
2import {execa} from '../../index.js';34// The file cannot be opened, since its directory does not exist.5// Its stream is created before the next item is rejected, which throws before spawning.6try {7 execa('empty.js', {stdout: [{file: '/nonexistent-directory-for-execa/file'}, ['foo']]});8} catch (error) {9 console.log(error.message);10}