-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] pebble "enter" keeps logging, with unexpected indentation, when combined with "exec" #339
Comments
(fyi @rebornplusplus ) |
The indentation thing is interesting. It has something to do with how the terminal device driver automatically injects CR before LF when output is written (and we're using a PTY / pseudo-terminal here). I haven't figured out the details yet, but see more at https://unix.stackexchange.com/a/151963 Not also that logs go to stderr, not stdout (I'll change that in the issue description). I'm not sure just disabling logs is what we want here, or what the fix for the CR/LF issue is. Do you have time to investigate further? I think there's enough subtlety here that it's worth writing a one-pager spec on your findings and a proposed fix so we can discuss further. |
thanks for the stderr fix. I think disabling the logs is the expected UX. Especially if the user is interacting with the |
This commit disables logs completely for ``pebble enter --verbose exec -it <cmd..>`` even if the --verbose flag is passed. Interactive applications, like Vim, can be run as an exec command: pebble enter --verbose exec -it vim Since enter runs the pebble daemon and executes the exec command afterwards, the same TTY that will be made RAW by exec to run interactive applications like Vim is also used for logging and service outputs. Thus, the logs coming from pebble find the TTY RAW and a weird indentation is introduced. [1] The issue however is not limited to only indentation. For example, if a text editor was being run with exec -it, like Vim, the incoming logs would go to the text editor and may change the content of the editor’s buffer. This commit disables logs completely for ``pebble enter --verbose exec -it`` even if the --verbose flag is passed. Since logs are currently disabled for ``pebble enter exec`` if --verbose flag is not passed and -i, -t are assumed if stdin and stdout are TTYs, the commit only ignores the --verbose flag in cases where exec will make the TTY RAW. References: - [1] canonical#339
Closing this issue, as this is being addressed by removing |
@benhoyt this is still gonna be addressed as canonical/rockcraft#495 just makes this issue harder to notice, but it is still there. The idea is to completely disallow --verbose to be used with |
Got it -- in that case, re-opening. |
This commit blocks the usage of ``--verbose`` option in "enter" command whenever the "exec" subcommand follows. Thus, the following will result in errors: pebble enter --verbose [enter-OPTS*] exec [exec-OPTS] <cmd..> Everything else, however, are kept unchanged. So the following is okay: pebble enter [enter-OPTS*] exec [exec-OPTS] <cmd..> Note that enter-OPTS* refers to all "enter" options except -v, --verbose. Originated from canonical#339.
Closing this Pebble issue as it's not really a Pebble problem as such, and will be addressed when canonical/rockcraft#495 is merged. |
You should re-open @benhoyt , given the reason mentioned above #339 (comment) |
Oops, re-opening until #394 is merged. |
Description
When using
pebble enter
(which is the case for all rocks), Pebble will keep logging to STDOUT, regardless of the provided subcommand.Not only that, but it appears that there's also a flushing problem, as the logs come out with a weird indentation.
Reproduce
pebble enter --verbose exec -it bash
Here's the problem:
Proposal
Do not print logs when
pebble enter exec
(especially ifexec
is running in interactive mode)The text was updated successfully, but these errors were encountered: