From cc0cbb051872e9764f3cb1d0ef9342726c8f0bdf Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Sun, 3 Jul 2016 19:49:44 +0200 Subject: add silent lines --- lrep | 19 ++++++++++++++----- 1 file 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 -- cgit 1.4.1