summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-06-01 19:43:48 -0400
committerJules Laplace <julescarbon@gmail.com>2017-06-01 19:43:48 -0400
commitb694bd511ceccd00d4a4c98f36f910d5fc5f79c4 (patch)
tree4140fa5dfa77ce7684c17d98bdb19f44844bf09c /lib
parent291a7be04a43ef0062a31dbfafb481c6e7829b79 (diff)
email text
Diffstat (limited to 'lib')
-rw-r--r--lib/awprint/index.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/awprint/index.js b/lib/awprint/index.js
index dec43fd..f379ad8 100644
--- a/lib/awprint/index.js
+++ b/lib/awprint/index.js
@@ -4,6 +4,8 @@ var path = require('path')
mongoose.Promise = require('bluebird')
var socketIO = require('socket.io')
+var exec = require('child_process').exec
+
function AWPrint (options) {
if (!(this instanceof AWPrint))
return new AWPrint(options)
@@ -66,10 +68,18 @@ function AWPrint (options) {
router.post('/print', bodyParser.json({}), function (req, res) {
res.sendStatus(200)
- Print.update({ _id: req.body._id }, { printed: true, }).then( (req) => {
- // send a websocket message?
+ Print.findOne({ _id: req.body._id }).then( (job) => {
+ job.printed = true
+
+ var cmd = 'curl ' + job.url + ' | lpr -P ARMORYHPM553'
+ console.log(cmd)
+ exec(cmd, function(error, stdout, stderr) {
+ console.log('ok')
+ })
+
+ return job.save()
}).catch( (err) => {
- // idk
+ console.log('error saving?')
})
})