summaryrefslogtreecommitdiffstats
path: root/gold/bitcoinwisdom/beep.js
blob: 80a0cb0f7353bccc235abf849eea56de781d8cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module.exports = {
  create_beeper: create_beeper,
}

var child_process = require('child_process');

function create_beeper (spec) {
  return {
    beep: beep,
  }
  function beep (freq, len) {
    var child = child_process.spawn('beep', [
        '-f', freq,
        '-l', len,
    ]);
    child.stdout.on('data', function (data) {
      console.log('stdout: ' + data);
    });

    child.stderr.on('data', function (data) {
      console.log('stderr: ' + data);
    });

    child.on('close', function (code) {
      if (code !== 0) {
        console.log('child process exited with code ' + code);
      }
    });
  }
}