From 69c97fed09b7956503b28d18e96fc2dd924521f4 Mon Sep 17 00:00:00 2001 From: Paulo Castro Date: Tue, 15 Oct 2019 02:50:01 +0100 Subject: [PATCH] Remove 'internal sudo' command Change-type: patch Signed-off-by: Paulo Castro --- lib/actions/internal.coffee | 32 -------------------------------- lib/app-capitano.coffee | 1 - 2 files changed, 33 deletions(-) diff --git a/lib/actions/internal.coffee b/lib/actions/internal.coffee index 7a4a9984..e91bb086 100644 --- a/lib/actions/internal.coffee +++ b/lib/actions/internal.coffee @@ -54,35 +54,3 @@ exports.scanDevices = .then (hostnameOrIp) -> console.error("==> Selected device: #{hostnameOrIp}") .nodeify(done) - -exports.sudo = - signature: 'internal sudo ' - description: 'execute arbitrary commands in a privileged subprocess' - help: ''' - Don't use this command directly! - - must be passed as a single argument. That means, you need to make sure - you enclose in quotes (eg. balena internal sudo 'ls -alF') if for - whatever reason you invoke the command directly or, typically, pass - as a single argument to spawn (eg. `spawn('balena', [ 'internal', 'sudo', 'ls -alF' ])`). - - Furthermore, this command will naively split on whitespace and directly - forward the parts as arguments to `sudo`, so be careful. - ''' - hidden: true - action: (params, options, done) -> - os = require('os') - Promise = require('bluebird') - - return Promise.try -> - if os.platform() is 'win32' - windosu = require('windosu') - windosu.exec(params.command, {}) - else - { spawn } = require('child_process') - { wait } = require('rindle') - cmd = params.command.split(' ') - ps = spawn('sudo', cmd, stdio: 'inherit', env: process.env) - wait(ps) - - .nodeify(done) diff --git a/lib/app-capitano.coffee b/lib/app-capitano.coffee index 5cfb5188..0b04150e 100644 --- a/lib/app-capitano.coffee +++ b/lib/app-capitano.coffee @@ -128,7 +128,6 @@ capitano.command(actions.util.availableDrives) # ---------- Internal utils ---------- capitano.command(actions.internal.osInit) capitano.command(actions.internal.scanDevices) -capitano.command(actions.internal.sudo) #------------ Local build and deploy ------- capitano.command(actions.build)