Better way to limit output from a command. #649
Unanswered
deanveloper
asked this question in
General
Replies: 1 comment
-
Most like because gradle detects TTY. Implementing PTY (pseudo TTY) is a very different story and definitely out of the scope of zx. What can you do is write the output limiter yourself. Or Just omit the output altogether. const p = $`npm init`
for await (const chunk of p.stdout) {
// Decide if you want to output this chunk.
} |
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
-
I have been loving zx, and I use it a lot for writing userscripts! However, one of my main problems right now is that commands running within zx only pipe stdout to the terminal, but it would be amazing if the programs could instead run straight in the terminal itself.
In particular, we use gradle for the build pipeline at my job. However, the gradle commands are quite verbose (ie,
./gradlew hotDeploy upgrade -PhotDeploy.someOption -Pupgrade.someOption ...
). So I use somezx
userscripts to make it much easier to manage these!My particular problem comes because the output of these commands are also quite verbose. We have a very large monorepo, each subdirectory being a gradle module. This means every gradle command will check all of these subdirectories, and output multiple lines for each one asynchronously. The
gradlew
CLI does this nicely because it has control of the terminal - so it only shows around 5 modules' statuses at a time. However, because when it's running within zx, gradlew doesn't have access to the terminal, my terminal gets flooded with status updates from every module's build process.It'd be great if there was a way to limit the output of a process within zx. Either by allowing the process a "terminal" to run in, or perhaps just showing a live view of the tail of a process' output.
Also, imagine the possibilities if terminal control was better supported in zx! I could have 4 processes running concurrently, each one having their own few lines, showing the tail of their respective processes! Might be a bit too much work for something like that, though.
Beta Was this translation helpful? Give feedback.
All reactions