Skip to content

Commit 78792bd

Browse files
committed
Add CHANGELOG + Small improvement for #563
1 parent 8b38ddf commit 78792bd

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Add `interactive: true` setting to improve support for interactive CLI apps
6+
([#217](https://github.com/go-task/task/issues/217), [#563](https://github.com/go-task/task/pull/563)).
57
- Fix some `nil` errors
68
([#534](https://github.com/go-task/task/issues/534), [#573](https://github.com/go-task/task/pull/573)).
79
- Add ability to declare an included Taskfile as optional

docs/usage.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,28 @@ $ task default
950950

951951
> The `output` option can also be specified by the `--output` or `-o` flags.
952952

953+
## Interactive CLI application
954+
955+
When running interactive CLI applications inside Task they can sometimes behave
956+
weirdly, specially when the [output mode](#output-syntax) is set to something
957+
other than `interleaved` (the default), or when interactive apps are ran in
958+
parallel with other tasks.
959+
960+
The `interactive: true` tells Task this is an interactive application, and Task
961+
will try to optimize for it:
962+
963+
```yaml
964+
version: '3'
965+
966+
tasks:
967+
cmds:
968+
- vim my-file.txt
969+
interactive: true
970+
```
971+
972+
If you still have problem running an interactive app through Task, please open
973+
an issue about it.
974+
953975
## Short task syntax
954976

955977
Starting on Task v3, you can now write tasks with a shorter syntax if they

task.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,12 @@ func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfi
415415
return nil
416416
}
417417

418-
stdOut := e.Output.WrapWriter(e.Stdout, t.Prefix)
419-
stdErr := e.Output.WrapWriter(e.Stderr, t.Prefix)
420-
418+
outputWrapper := e.Output
421419
if t.Interactive {
422-
stdOut = output.Interleaved{}.WrapWriter(e.Stdout, t.Prefix)
423-
stdErr = output.Interleaved{}.WrapWriter(e.Stderr, t.Prefix)
420+
outputWrapper = output.Interleaved{}
424421
}
422+
stdOut := outputWrapper.WrapWriter(e.Stdout, t.Prefix)
423+
stdErr := outputWrapper.WrapWriter(e.Stderr, t.Prefix)
425424

426425
defer func() {
427426
if _, ok := stdOut.(*os.File); !ok {

0 commit comments

Comments
 (0)