Skip to content
Myr

Fix using files in both input and output (#1058)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent b9474c3 · Browse files · 2 files+15 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−1 removed

  • tests:+14 added−0 removed
  • other:+1 added−1 removed

2 files+15 added−1 removed

modified:lib/stdio/duplicate.js+1 added-1 removed
modified:test/stdio/duplicate.js+14 added
174 unmodified lines
175test('Can re-use same file path on different output file descriptors, sync', testMultipleFileOutput, getAbsolutePath, execaSync);176test('Can re-use same file URL on different output file descriptors', testMultipleFileOutput, pathToFileURL, execa);177test('Can re-use same file URL on different output file descriptors, sync', testMultipleFileOutput, pathToFileURL, execaSync);178179const testMultipleFileInputOutput = async (t, mapFile, execaMethod) => {180 const inputFilePath = tempfile();181 const outputFilePath = tempfile();182 await writeFile(inputFilePath, foobarString);183 await execaMethod('stdin.js', {stdin: mapFile(inputFilePath), stdout: mapFile(outputFilePath)});184 t.is(await readFile(outputFilePath, 'utf8'), foobarString);185 await Promise.all([rm(inputFilePath), rm(outputFilePath)]);186};187188test('Can use different file paths on different input/output file descriptors', testMultipleFileInputOutput, getAbsolutePath, execa);189test('Can use different file paths on different input/output file descriptors, sync', testMultipleFileInputOutput, getAbsolutePath, execaSync);190test('Can use different file URL on different input/output file descriptors', testMultipleFileInputOutput, pathToFileURL, execa);191test('Can use different file URL on different input/output file descriptors, sync', testMultipleFileInputOutput, pathToFileURL, execaSync);192193// eslint-disable-next-line max-params194const testMultipleInvalid = async (t, getDummyStream, typeName, getStdio, fdName, execaMethod) => {195 const stdioOption = await getDummyStream();196 t.throws(() => {
17 unmodified lines