Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 62d71d6

Browse files
committed
fix(packages/core): avoid redirect handling in core for semicolon invokes
1 parent 70f8c86 commit 62d71d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/repl/exec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class InProcessExecutor implements Executor {
373373
const evaluatorOptions = evaluator.options
374374

375375
// are we asked to redirect the output to a file?
376-
const redirectDesired = !noCoreRedirect && !!pipeStages.redirect
376+
let redirectDesired = !noCoreRedirect && !!pipeStages.redirect
377377

378378
this.emitStartEvent({
379379
tab,
@@ -465,6 +465,7 @@ class InProcessExecutor implements Executor {
465465
if (commands.length > 1) {
466466
// e.g. "a ; b ; c"
467467
response = await semicolonInvoke(commands, execOptions)
468+
redirectDesired = false // any redirects will be handled in the respective semi invoke
468469
} else {
469470
// e.g. just "a" or "a > /tmp/foo"
470471
try {
@@ -763,14 +764,13 @@ async function redirectResponse<T extends KResponse>(
763764

764765
if (response === true) {
765766
// probably a mis-parsing of the redirect
766-
767767
} else if (Buffer.isBuffer(response) || typeof response === 'string' || isXtermResponse(response)) {
768768
try {
769769
const data = isXtermResponse(response) ? response.rows.map(i => i.map(j => j.innerText)).join(' ') : response
770770
const writeOptions = redirector === '>>' ? '--append' : ''
771771
await rexec<{ data: string }>(`vfs fwrite ${encodeComponent(expandHomeDir(filepath))} ${writeOptions}`, { data })
772772

773-
debug(`redirected response to ${filepath}`)
773+
debug(`redirected response to ${filepath}`, response)
774774
} catch (err) {
775775
console.error(err)
776776
throw new Error(`Error in redirect: ${err.message}`)

0 commit comments

Comments
 (0)