Feature request: corollary to `sh` that captures stdout

Open
#678 241 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
ruby
Domain
build-system

Research direction

Start by reviewing Rake's existing sh entry point and the issue discussion about capturing stderr and stdout. Determine the intended API and how it should preserve sh's verbose and noop capabilities; done requires a decided behavior and corresponding implementation and tests.

Written by the indexing model from the issue text.

Description

It seems a common occurrence for me to have custom tasks that need to invoke a shell command, and capture the output.

The "simple" solution is to use backticks or %x to capture the command's stderr/stdout. However, using that isn't safe or recommended. Further, it loses all the helpful verbose and noop capabities that rake's own sh provides.

What do others do in this situation? Would it be helpful to have a version of sh that captures stderr and stdout? (Or to upgrade sh such that the resulting response object has stderr and stdout?)

Any other alternatives I'm missing?

Dominant language
Ruby
Stars
2.5k
Forks
649
Avg merge
4m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/rake

All issues in ruby/rake

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.