Skip to content

Commit

Permalink
stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
laduke committed Oct 10, 2023
1 parent 7e393f2 commit 24af618
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/loads-remote-networks.js
Expand Up @@ -22,12 +22,22 @@ export async function loadSTDIN () {
input: process.stdin,
});


let lines = ''

setTimeout(() => {
rl.close()
}, 100)

for await (const line of rl) {
lines = lines.concat(line)
}

return JSON.parse(lines)
if (lines.length) {
return JSON.parse(lines)
} else {
return []
}
}

function flatten (xs = []) {
Expand Down

0 comments on commit 24af618

Please sign in to comment.