From: Jason Woofenden Date: Wed, 30 Jan 2013 05:03:05 +0000 (-0500) Subject: test code to read stdin from script X-Git-Tag: v1.0~47 X-Git-Url: https://jasonwoof.com/gitweb/?p=watch-my-terminal.git;a=commitdiff_plain;h=b6d55dd2c979bd2edacbce3fd725ba40b8f52d8c test code to read stdin from script --- diff --git a/input-test.coffee b/input-test.coffee new file mode 100644 index 0000000..fbb2a6e --- /dev/null +++ b/input-test.coffee @@ -0,0 +1,9 @@ +child_process = require 'child_process' + +process.stdin.resume() +process.stdin.setEncoding 'utf8' + +process.stdin.on 'data', (data) -> + child_process.spawn 'notify-send', ['--expire-time=1000', "length: #{data.length}", data] + +process.stdin.on 'end', -> process.exit()