|
2 | 2 |
|
3 | 3 | /* eslint-env node*/ |
4 | 4 |
|
5 | | -exports.unsafeFromNullable = function unsafeFromNullable(msg){ |
6 | | - return function(x) { |
7 | | - if (x === null) { |
8 | | - throw new Error(msg); |
9 | | - } else { |
10 | | - return x; |
11 | | - }; |
| 5 | +exports.unsafeFromNullable = function unsafeFromNullable (msg) { |
| 6 | + return function (x) { |
| 7 | + if (x === null) throw new Error(msg); |
| 8 | + return x; |
12 | 9 | }; |
13 | 10 | }; |
14 | | -exports.spawnImpl = function spawnImpl(command) { |
15 | | - return function(args) { |
16 | | - return function(opts) { |
17 | | - return function() { |
| 11 | + |
| 12 | +exports.spawnImpl = function spawnImpl (command) { |
| 13 | + return function (args) { |
| 14 | + return function (opts) { |
| 15 | + return function () { |
18 | 16 | return require("child_process").spawn(command, args, opts); |
19 | 17 | }; |
20 | 18 | }; |
21 | 19 | }; |
22 | 20 | }; |
23 | | -exports.execImpl = function execImpl(command) { |
24 | | - return function(opts) { |
25 | | - return function(callback) { |
26 | | - return function() { |
27 | | - return require("child_process").exec(command, opts, function(err, stdout, stderr) { |
| 21 | + |
| 22 | +exports.execImpl = function execImpl (command) { |
| 23 | + return function (opts) { |
| 24 | + return function (callback) { |
| 25 | + return function () { |
| 26 | + return require("child_process").exec(command, opts, function (err, stdout, stderr) { |
28 | 27 | callback(err)(stdout)(stderr)(); |
29 | 28 | }); |
30 | 29 | }; |
31 | 30 | }; |
32 | 31 | }; |
33 | 32 | }; |
34 | | -exports.execFileImpl = function execImpl(command) { |
35 | | - return function(args) { |
36 | | - return function(opts) { |
37 | | - return function(callback) { |
38 | | - return function() { |
39 | | - return require("child_process").execFile(command, args, opts, function(err, stdout, stderr) { |
| 33 | + |
| 34 | +exports.execFileImpl = function execImpl (command) { |
| 35 | + return function (args) { |
| 36 | + return function (opts) { |
| 37 | + return function (callback) { |
| 38 | + return function () { |
| 39 | + return require("child_process").execFile(command, args, opts, function (err, stdout, stderr) { |
40 | 40 | callback(err)(stdout)(stderr)(); |
41 | 41 | }); |
42 | 42 | }; |
43 | 43 | }; |
44 | 44 | }; |
45 | 45 | }; |
46 | 46 | }; |
47 | | -exports.fork = function fork(cmd) { |
48 | | - return function(args) { |
49 | | - return function() { |
| 47 | + |
| 48 | +exports.fork = function fork (cmd) { |
| 49 | + return function (args) { |
| 50 | + return function () { |
50 | 51 | return require("child_process").fork(cmd, args); |
51 | 52 | }; |
52 | 53 | }; |
53 | 54 | }; |
54 | | -exports.mkOnExit = function mkOnExit(mkChildExit){ |
55 | | - return function onExit(cp){ |
56 | | - return function(cb){ |
57 | | - return function(){ |
58 | | - cp.on("exit", function(code, signal){ |
| 55 | + |
| 56 | +exports.mkOnExit = function mkOnExit (mkChildExit) { |
| 57 | + return function onExit (cp) { |
| 58 | + return function (cb) { |
| 59 | + return function () { |
| 60 | + cp.on("exit", function (code, signal) { |
59 | 61 | cb(mkChildExit(code)(signal))(); |
60 | 62 | }); |
61 | 63 | }; |
62 | 64 | }; |
63 | 65 | }; |
64 | 66 | }; |
65 | | -exports.mkOnClose = function mkOnClose(mkChildExit){ |
66 | | - return function onClose(cp){ |
67 | | - return function(cb){ |
68 | | - return function(){ |
69 | | - cp.on("exit", function(code, signal){ |
| 67 | + |
| 68 | +exports.mkOnClose = function mkOnClose (mkChildExit) { |
| 69 | + return function onClose (cp) { |
| 70 | + return function (cb) { |
| 71 | + return function () { |
| 72 | + cp.on("exit", function (code, signal) { |
70 | 73 | cb(mkChildExit(code)(signal))(); |
71 | 74 | }); |
72 | 75 | }; |
73 | 76 | }; |
74 | 77 | }; |
75 | 78 | }; |
76 | | -exports.onDisconnect = function onDisconnect(cp){ |
77 | | - return function(cb){ |
78 | | - return function(){ |
| 79 | + |
| 80 | +exports.onDisconnect = function onDisconnect (cp) { |
| 81 | + return function (cb) { |
| 82 | + return function () { |
79 | 83 | cp.on("disconnect", cb); |
80 | 84 | }; |
81 | 85 | }; |
82 | 86 | }; |
83 | | -exports.mkOnMessage = function mkOnMessage(nothing){ |
84 | | - return function(just){ |
85 | | - return function onMessage(cp){ |
86 | | - return function(cb){ |
87 | | - return function(){ |
88 | | - cp.on("message", function(mess, sendHandle){ |
| 87 | + |
| 88 | +exports.mkOnMessage = function mkOnMessage (nothing) { |
| 89 | + return function (just) { |
| 90 | + return function onMessage (cp) { |
| 91 | + return function (cb) { |
| 92 | + return function () { |
| 93 | + cp.on("message", function (mess, sendHandle) { |
89 | 94 | cb(mess, sendHandle ? just(sendHandle) : nothing)(); |
90 | 95 | }); |
91 | 96 | }; |
92 | 97 | }; |
93 | 98 | }; |
94 | 99 | }; |
95 | 100 | }; |
96 | | -exports.onError = function onError(cp){ |
97 | | - return function(cb){ |
98 | | - return function(){ |
99 | | - cp.on("error", function(err) { |
100 | | - cb(err)() |
| 101 | + |
| 102 | +exports.onError = function onError (cp) { |
| 103 | + return function (cb) { |
| 104 | + return function () { |
| 105 | + cp.on("error", function (err) { |
| 106 | + cb(err)(); |
101 | 107 | }); |
102 | 108 | }; |
103 | 109 | }; |
104 | 110 | }; |
105 | 111 |
|
106 | | -exports["undefined"] = undefined; |
| 112 | +exports.undefined = undefined; |
107 | 113 | exports.process = process; |
0 commit comments