const { spawnSync } = require('child_process');
const fs = require('fs-extra');
function trimFile() {
let rfd;
let wfd;
try {
rfd = fs.openSync('filelist.txt', 'r');
wfd = fs.openSync('filesonly.txt', 'w');
spawnSync('cut -d" " -f1', { stdio: [wfd, rfd, 'inherit'] });
}
finally {
fs.closeSync(rfd);
fs.closeSync(wfd);
}
}
Here is my stackoverflow link to the question. https://stackoverflow.com/questions/58796378/spawnsync-for-shell-commands
I wonder if this may be a bug?
11.8.0
Ubuntu 18.04
Linux computerName 4.15.0-66-generic Deprecate domains node#75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
child_process