UNPKG

rkeys

Version:

A platform for creating tablet/HTML5 virtual-keyboard apps to send keystrokes to remote X11

38 lines (37 loc) 882 B
// Generated by LiveScript 1.3.0 (function(){ var _, Cp, D, join$ = [].join; _ = require('lodash'); Cp = require('child_process'); D = require('../constants').directions; module.exports = function(arg$){ var command, direction, id, arr, cmd; command = arg$.command, direction = arg$.direction, id = arg$.id; if (command == null) { return false; } if (_.isArray(command)) { command = command[direction]; } else { if (direction !== D.DOWN) { return; } } if ((arr = command.split(' '))[0] !== 'exec') { return false; } cmd = join$.call(arr.slice(1), ' '); Cp.exec(cmd, function(err, stdout, stderr){ if (err) { log(err); } if (stdout) { log(stdout); } if (stderr) { return log(stderr); } }); return true; }; }).call(this);