Skip to content

Commit 30641e2

Browse files
Replaced Open3 with Posix-spawn to reduce more process memory usage
1 parent 7da779e commit 30641e2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,17 @@ hg 1.1.2
4949
If you are using CVS instead of CVSNT, you can potentially try creating
5050
a shell alias or symlink mapping 'cvsnt' to 'cvs'.
5151

52+
Ohloh SCM uses [posix-spawn](https://github.com/rtomayko/posix-spawn) to
53+
execute commands so ensure *posix-spawn* gem is installed
54+
55+
``gem install posix-spawn``
56+
57+
5258
## Usage with Bundler
5359

5460
```
5561
gem 'ohloh_scm', git: 'https://github.com/blackducksw/ohloh_scm/', require: 'scm'
62+
gem 'posix-spawn'
5663
```
5764
## Running
5865

lib/ohloh_scm/shellout.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rubygems'
22
require 'stringio'
3-
require 'open3'
3+
require 'posix/spawn'
44

55
class Shellout
66

@@ -9,9 +9,9 @@ def self.relay src, dst
99
end
1010

1111
def self.execute(cmd)
12-
out, err, exit_status = Open3.capture3(cmd)
12+
posix_spawn = POSIX::Spawn::Child.new(cmd)
1313

14-
return exit_status, out, err
14+
return posix_spawn.status, posix_spawn.out, posix_spawn.err
1515
end
1616

1717
def run(cmd)

0 commit comments

Comments
 (0)