Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug: within(directory){ execute(string) } should either 'just work' or 'boom'

オープン
#306 コメント 12 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
ruby
領域
devops

調査の方向性

まず、既存の within と execute のエントリポイントと、それらに関するドキュメントを読み、ここで説明されている、ディレクトリが黙って無視される挙動と、失敗するディレクトリとの対比を再現してください。文字列コマンドを動作させるか、例外を発生させるか、within を削除するかという設計上の選択を解決し、選択した挙動を文書化してテストしてください。

索引モデルが issue の本文から書いたものです。

説明

docs aren't good enough to explain the design choice IMHO - just check
stackoverflow...

one solution is just to fix it - use shellwords to properly escape the command

  require 'shellwords'

  def execute(*args, &block)
    if args.first.is_a?(String)
      command = Shellwords.escape(args.first)
    end

    # ...
  end

otherwise raise an exception

  def execute(*args, &block)
    if args.first.is_a?(String) and inside_within?
      raise "don't do that"
    end

    # ...
  end

the current behavior of doing

  within directory do  # silently ignored
    execute command
  end

just isn't POLS - the point of a library like cap is to be able to re-use code
but, currently, each and every use must re-invent 'cd into a (properly escaped
directory) and run commands', including handling the fact that

  within(does_not_exist) do # raises
  end
  execute "#{ does_not_exist }; command.sh" # reports a failed exit status that leads to debugging which part failed

a final solution would be to remove the 'within' API since it sometimes works,
and sometimes does not, issuing no exception nor warning

主要言語
Ruby
スター
1.2k
フォーク
257
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

capistrano/sshkit のほかの issue

capistrano/sshkit の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。