diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-03 19:49:44 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-03 19:49:44 +0200 |
commit | cc0cbb051872e9764f3cb1d0ef9342726c8f0bdf (patch) | |
tree | 44750d9b71989e2c563a176d1a6ac9243ed7b576 | |
parent | a48a3d5856b4b541205ad1515248ab3600dae254 (diff) | |
download | lrep-cc0cbb051872e9764f3cb1d0ef9342726c8f0bdf.tar.gz lrep-cc0cbb051872e9764f3cb1d0ef9342726c8f0bdf.tar.xz lrep-cc0cbb051872e9764f3cb1d0ef9342726c8f0bdf.zip |
add silent lines
-rwxr-xr-x | lrep | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lrep b/lrep index 8f69f99..0548670 100755 --- a/lrep +++ b/lrep @@ -78,10 +78,15 @@ while line = gets psl = /^\t.*?#{Regexp.union [$1,$2].compact}(.*)/ end next if zap - output, input, pid = PTY.spawn $3 + + cmd = $3 + silent = cmd.gsub!(/>-$/, '') + + output, input, pid = PTY.spawn cmd input.echo = false # more timeout to launch program - print ind(readp(output, ps, $timeout*20)) + o = readp(output, ps, $timeout*20) + print ind(o) unless silent end rescue print ind("ERROR: #{$!.message}") @@ -90,10 +95,14 @@ while line = gets puts line next if zap if input -# p [:WRITE, $1 + "\n"] - input.write $1 + "\n" + cmd = $1 + silent = cmd.gsub!(/>-$/, '') + +# p [:WRITE, cmd + "\n"] + input.write cmd + "\n" + o = readp(output, ps) + print ind(o) unless silent end - print ind(readp(output, ps)) elsif line =~ /^\t/ # old output, remove else |