ruby / ruby/rake

Feature request: corollary to `sh` that captures stdout

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

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.5k
Forks
650
Avg merge
6m
Merged PRs (30d)
3

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?

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.