Currently looking for a suitable replacement of child_process/spawn and readline (node:readline/promises) - I found bun-utilities/spawn but no examples of how to use it. The code I'm trying to replicate is:
const { spawn } = require('child_process')
const readline = require('node:readline/promises')
const child = spawn('tail -f', ['access.log'])
rl = readline.createInterface({
input: child.stdout,
output: null,
})
for await (const line of rl) {
this.processLine(line)
}
How can I do this in Bun?
I saw the Github issues and saw that readline isn't implemented yet, but was suggested to use exec instead (because it provides a string out). Unfortunately the example didn't say whether exec would work for some long running process like tail -f access.log