diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-01 03:30:39 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-01 03:30:39 +0200 |
| commit | 964ac7009e6db5a06233bdc07fa63778eebf2db7 (patch) | |
| tree | 960ceb019514f960a6597b9b282baf4d5cd77607 /app/relay/remote.js | |
| parent | dd31a7b9a3af167808b04ffe2af3a66af8b17c33 (diff) | |
async commands!!
Diffstat (limited to 'app/relay/remote.js')
| -rw-r--r-- | app/relay/remote.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/app/relay/remote.js b/app/relay/remote.js index e468c7d..7c70c26 100644 --- a/app/relay/remote.js +++ b/app/relay/remote.js @@ -74,25 +74,41 @@ remote.on('task', (data) => { remote.on('system', (data) => { console.log('system:', data.cmd) + // console.log(data) switch(data.cmd) { case 'run_system_command': runner.run_system_command(data.payload, (error, stdout, stderr) => { remote.emit('system_res', { - type: 'command_output', + type: 'run_system_command', cmd: data.payload, + uuid: data.uuid, error, stdout, stderr }) }) break + case 'list_directory': + runner.list_directory(data.payload, (files) => { + remote.emit('system_res', { + type: 'list_directory', + dir: data.payload, + uuid: data.uuid, + files, + }) + }) case 'get_status': remote.emit('system_res', { type: 'relay_status', rpc_connected: get_connected(), + uuid: data.uuid, runner: runner.status(), }) break default: - remote.emit('system_res', { type: 'error', error: 'unknown system command' }) + remote.emit('system_res', { + type: 'error', + error: 'unknown system command', + uuid: data.uuid, + }) break } }) |
