nrser-rash 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +104 -0
- data/.gitmodules +4 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/.yardopts +7 -0
- data/Gemfile +10 -0
- data/README.md +4 -0
- data/Rakefile +6 -0
- data/bash/source-profile.sh +17 -0
- data/dev/bin/.gitkeep +0 -0
- data/dev/bin/console +33 -0
- data/dev/bin/rake +3 -0
- data/dev/bin/rash +16 -0
- data/dev/bin/rspec +3 -0
- data/dev/ref/autocomplete.rb +62 -0
- data/dev/scratch/apps.AppleScript +14 -0
- data/dev/scratch/blocks.rb +232 -0
- data/dev/scratch/decorating_methods.rb +18 -0
- data/dev/scratch/functions.sh +80 -0
- data/dev/scratch/if.sh +16 -0
- data/dev/scratch/inc.rb +3 -0
- data/dev/scratch/inheriting_env/main.rb +44 -0
- data/dev/scratch/inheriting_env/sub.rb +9 -0
- data/dev/scratch/load_main.rb +5 -0
- data/dev/scratch/load_module.rb +19 -0
- data/dev/scratch/lsregister-dump.txt +30165 -0
- data/dev/scratch/main.rb +4 -0
- data/dev/scratch/optparse.rb +43 -0
- data/dev/scratch/overridding-cd.sh +53 -0
- data/dev/scratch/path.sh +22 -0
- data/dev/scratch/pirating_methods.rb +62 -0
- data/dev/scratch/profile.sh +624 -0
- data/dev/scratch/return.sh +5 -0
- data/dev/scratch/source_rvm.sh +11 -0
- data/dev/scratch/stub-names/project/test +3 -0
- data/exe/rash +4 -0
- data/lib/nrser/rash/cli/call.rb +137 -0
- data/lib/nrser/rash/cli/help.rb +29 -0
- data/lib/nrser/rash/cli/list.rb +36 -0
- data/lib/nrser/rash/cli/run.rb +54 -0
- data/lib/nrser/rash/cli.rb +21 -0
- data/lib/nrser/rash/config.rb +172 -0
- data/lib/nrser/rash/core_ext/object.rb +55 -0
- data/lib/nrser/rash/formatters.rb +105 -0
- data/lib/nrser/rash/functions.rb +154 -0
- data/lib/nrser/rash/helpers.rb +53 -0
- data/lib/nrser/rash/testing.rb +305 -0
- data/lib/nrser/rash/util.rb +260 -0
- data/lib/nrser/rash/version.rb +17 -0
- data/lib/nrser/rash.rb +40 -0
- data/nrser-rash.gemspec +48 -0
- data/tmp/.gitkeep +0 -0
- metadata +248 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'io/wait'
|
2
|
+
|
3
|
+
ENV['X'] = 'ex'
|
4
|
+
|
5
|
+
# open a pipe to `sub.rb` for reading and writing
|
6
|
+
fp = IO.popen("ruby #{File.dirname(__FILE__)}/sub.rb", 'r+')
|
7
|
+
|
8
|
+
# read the initial dump from it
|
9
|
+
sub_output_1 = ""
|
10
|
+
# we need to wait until it's sent data
|
11
|
+
sleep 1 while (not fp.ready?)
|
12
|
+
# then read into `sub_output_1` while it's still has data
|
13
|
+
while fp.ready?
|
14
|
+
# i don't know if i need to read in chunks of 1 or what but that seemed
|
15
|
+
# like a safe choice. there is a also a `read_nonblocking` call that
|
16
|
+
# might be useful instead but looks kinda complicated
|
17
|
+
sub_output_1 += fp.read(1)
|
18
|
+
end
|
19
|
+
# ok, there is no more output waiting
|
20
|
+
# dump what we have
|
21
|
+
puts "*** SUB OUTPUT 1 ***"
|
22
|
+
puts sub_output_1
|
23
|
+
|
24
|
+
# this means the pipe is read for input
|
25
|
+
# we now have control back and sub is blocked waiting on our write
|
26
|
+
# change an ENV var now
|
27
|
+
ENV['Y'] = 'why'
|
28
|
+
puts "WRITING...."
|
29
|
+
fp.puts "hey there!"
|
30
|
+
puts "WRITTEN."
|
31
|
+
|
32
|
+
# that should get sub un-blocked
|
33
|
+
# now repeat the process above to see what it says
|
34
|
+
sub_output_2 = ""
|
35
|
+
sleep 1 while (not fp.ready?)
|
36
|
+
while fp.ready? && (not fp.eof?)
|
37
|
+
sub_output_2 += fp.read(1)
|
38
|
+
end
|
39
|
+
puts "*** SUB OUTPUT 2 ***"
|
40
|
+
puts sub_output_2
|
41
|
+
# doesn't look like it gets the ENV update
|
42
|
+
|
43
|
+
# be a good samaritan
|
44
|
+
fp.close
|