Skip to content

Instantly share code, notes, and snippets.

View okamuuu's full-sized avatar

okamuuu okamuuu

View GitHub Profile
@kjunichi
kjunichi / node.js_child_process.spawn.js
Last active March 29, 2017 01:19
node.jsでパイプを使ったコマンドを実行するには
const spawn = require('child_process').spawn;
const cmd = "top -l1|grep usage|cut -d' ' -f3|tr -d '%'|tr -d '\n'";
const child = shspawn(cmd);
let buf="";
child.stdout.on('data',(data)=>{
buf=buf+data;