canonical / canonical/craft-cli

Brief Emitter mode still appears to be verbose when plugins are called ?

Open
#243 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16
Forks
27
Avg merge
1d 22h
Merged PRs (30d)
10

Description

### What needs to get done

I am not 100% sure if my observation is correct, but hopefully an expert could help me out ?

I am starting the Emitter with ```streaming_brief=False```

In fact the CLI startup code in some secret craft project looks like this:

```python
for lib_name in ("craft_providers", "craft_parts"):
logger = logging.getLogger(lib_name)
logger.setLevel(logging.DEBUG)

emit.init(
EmitterMode.BRIEF,
"XXXcraft",
f"Starting XXXcraft version {__version__}",
log_filepath=logpath,
streaming_brief=False,
)
```

and then inside my lifecycle code (not using craft-application, but doing the same thing)

```python
with self._lcm.action_executor() as aex:
emit.message("Processing firmware parts ...")
for act in actions:
emit.progress(
f"{step_to_action(act.step, True)} {act.part_name!r} ..."
)
with emit.open_stream() as stream:
aex.execute([act], stdout=stream, stderr=stream)
```

However when I look at the plugin handler code, it looks like we are passing the stdout / stderr to the script so that whatever is processed by the script, will result in each shell line being echoed, and as a result, I see lots of lines:

```shell
+ ln ... ....
+ cp x .. y
```

See:
craft-parts/craft_part/_create_and_run_script
_create_and_run_script(..)

I see the same detailed output from the **autotools** plugin.

### Why it needs to get done

Am I missing a trick to suppress the detailed output while running a progress runner in BRIEF emitter mode ?

Contributor guide

Open the contributing guide

Research direction

Start by reading craft_part/_create_and_run_script and the autotools plugin handler mentioned in the issue, then trace how stdout and stderr are passed through emit.open_stream() in EmitterMode.BRIEF. Compare that path with the emitter's streaming_brief behavior. Done means the expected brief-mode output behavior is established and covered for plugin execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.