TypeError: accounts is not iterable, how to iterate over shell output? #502
Unanswered
kaihendry
asked this question in
Help needed
Replies: 2 comments 3 replies
-
Use
|
Beta Was this translation helpful? Give feedback.
3 replies
-
I don't know if it's still relevant, but here's what's available now:
const p = $`echo 'foo\nbar\r\nbaz'`
assert.deepEqual(await p.lines(), ['foo', 'bar', 'baz'])
// Iterate over the running process chunks
const process = $`echo "Line1\nLine2\nLine3"`
const lines = []
for await (const line of process) {
lines.push(line)
}
assert.deepEqual(lines, ['Line1', 'Line2', 'Line3'])
// Process the output
const o = await $`echo "Line1\nLine2\nLine3"`
const lines = []
for (const line of o) {
lines.push(line)
}
assert.deepEqual(lines, ['Line1', 'Line2', 'Line3']) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Assuming there are many several directories in stacks, how do I iterate over the ls output, like you would do in a while loop in bash?
Beta Was this translation helpful? Give feedback.
All reactions