Skip to content

Commit 65c9abf

Browse files
committed
git-all: use IO.popen + GNU find, instead of PTY.spawn
1 parent a25781f commit 65c9abf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

git-all

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# Report the status of all Git repositories within a directory tree.
44

5-
require 'pty'
65
require 'main'
76
require 'git'
87

@@ -142,10 +141,11 @@ Main {
142141
def run
143142
$params = params
144143
seen = Set.new
145-
cmd = "find -H #{$params[:dir].values * ' '} -name .git"
144+
dirs = $params[:dir].values * ' '
146145

147-
PTY.spawn cmd do |stdin, stdout, pid|
148-
stdin.each do |path|
146+
# This command relies on GNU find's -printf directive
147+
IO.popen "find -H -L #{dirs} -name .git -printf '%p\\n\\c'" do |io|
148+
while path = io.gets
149149
next if seen.include? path # never process the same path twice
150150
seen << path
151151

@@ -155,6 +155,7 @@ Main {
155155
GitUpdate.top_ten('FAILED', path, [ex.message] + ex.backtrace,
156156
false, '#')
157157
end
158+
STDOUT.flush
158159
end
159160
end
160161
end

0 commit comments

Comments
 (0)