MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / exec

Method exec

src/plugins/sftp/src/com/foxdebug/sftp/Sftp.java:275–300  ·  view source on GitHub ↗
(JSONArray args, CallbackContext callback)

Source from the content-addressed store, hash-verified

273 }
274
275 public void exec(JSONArray args, CallbackContext callback) {
276 cordova
277 .getThreadPool()
278 .execute(
279 new Runnable() {
280 public void run() {
281 try {
282 String command = args.optString(0);
283 if (ssh != null) {
284 JSONObject res = new JSONObject();
285 StringBuffer buffer = new StringBuffer();
286 int code = ssh.executeCommandWithResult(command, buffer);
287 String result = buffer.toString();
288 res.put("code", code);
289 res.put("result", result);
290 callback.success(res);
291 return;
292 }
293 callback.error("Not connected");
294 } catch (IOException | JSONException e) {
295 callback.error(errMessage(e));
296 }
297 }
298 }
299 );
300 }
301
302 public void getFile(JSONArray args, CallbackContext callback) {
303 cordova

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected