(method)
| 94 | farmer = await utils(options); |
| 95 | }; |
| 96 | const asyncTask = (method) => async (code) => { |
| 97 | // race condition ... a new task has been |
| 98 | // assigned while the previous one didn't finish |
| 99 | if (working) await reload(); |
| 100 | working = true; |
| 101 | try { |
| 102 | return await farmer[method](dedent(code)); |
| 103 | } catch (e) { |
| 104 | console.error(e); |
| 105 | } finally { |
| 106 | working = false; |
| 107 | } |
| 108 | }; |
| 109 | const asyncMethod = (method) => async () => { |
| 110 | if (working) await reload(); |
| 111 | else farmer?.terminal[method](); |