Skip to content

Commit

Permalink
Do not stream bundle exec rake -P output or bundle list
Browse files Browse the repository at this point in the history
These outputs are meant to be machine readable only, it should be timed and not streamed.

I.e. we want the output to be

```
- Rake assets install
  - Rake detected (`rake` gem found, `Rakefile` found ad `/workspace/Rakefile`)
  - Running `bundle exec rake -P --trace` .... (2.1s)
  - Compiling assets with cache (detected `rake assets:precompile` and `rake assets:clean` via `bundle exec rake -P`)
```

And not

```
- Rake assets install
  - Rake detected (`rake` gem found, `Rakefile` found ad `/workspace/Rakefile`)
  - Running `bundle exec rake -P --trace`

      rake about
          environment
      rake action_mailbox:ingress:environment
      rake action_mailbox:ingress:exim
          action_mailbox:ingress:environment
      rake action_mailbox:ingress:postfix
          action_mailbox:ingress:environment
      rake action_mailbox:ingress:qmail
          action_mailbox:ingress:environment
      rake action_mailbox:install
      rake action_mailbox:install:migrations
      rake action_text:install
      rake action_text:install:migrations
      rake active_storage:install
          environment
      rake active_storage:install:migrations
      rake active_storage:update

	  [...]

  - Done (2.111s)
  - Compiling assets with cache (detected `rake assets:precompile` and `rake assets:clean` via `bundle exec rake -P`)

```
  • Loading branch information
schneems committed Oct 6, 2023
1 parent 4b2e4c3 commit a97dec6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions buildpacks/ruby/src/gem_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ impl GemList {
let mut cmd = Command::new("bundle");
cmd.arg("list").env_clear().envs(envs);

log_step_stream(format!("Running {}", fmt::command(cmd.name())), |stream| {
let output = cmd.stream_output(stream.io(), stream.io())?;
let output = log_step_timed(format!("Running {}", fmt::command(cmd.name())), || {
cmd.named_output()
})?;

GemList::from_str(&output.stdout_lossy())
})
GemList::from_str(&output.stdout_lossy())
}

#[must_use]
Expand Down
4 changes: 2 additions & 2 deletions buildpacks/ruby/src/rake_task_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ impl RakeDetect {
.env_clear()
.envs(envs);

log_step_stream(format!("Running {}", fmt::command(cmd.name())), |stream| {
cmd.stream_output(stream.io(), stream.io())
log_step_timed(format!("Running {}", fmt::command(cmd.name())), || {
cmd.named_output()
})
.or_else(|error| {
if error_on_failure {
Expand Down

0 comments on commit a97dec6

Please sign in to comment.