Skip to content

Instantly share code, notes, and snippets.

@meaku
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meaku/f2e5fc688ed9059d4ebe to your computer and use it in GitHub Desktop.
Save meaku/f2e5fc688ed9059d4ebe to your computer and use it in GitHub Desktop.
autoresponder.js
#!/usr/bin/env node
"use strict";
console.log("checking for auto responses");
var fs = require("fs"),
exec = require("child_process").exec;
var input = "";
process.stdin.on("data", function (chunk) {
input += chunk;
});
process.stdin.on("end", function () {
console.log("input", input);
var cmd = 'qmail-autoresponder autoresponders/autotest/ <<< "' + input + '"';
fs.writeFileSync(__dirname + "/qmail-log.txt", cmd);
//autorespond.js / < qmail-test.txt
var child = exec(cmd, function (err, stdout, stderr) {
console.log("done", arguments);
process.exit(0);
});
})
//0.8 hack
process.stdin.resume()
//kill after 5 seconds if not done
setTimeout(function () {
process.exit(0);
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment