fixup! gluon-web-admin: use util.popen3 in remote.lua

This commit is contained in:
aiyion.prime 2021-07-11 22:51:39 +02:00
parent 436b06d910
commit 1d7fc2dd43

View File

@ -12,6 +12,7 @@ You may obtain a copy of the License at
local util = require 'gluon.util' local util = require 'gluon.util'
local site = require 'gluon.site' local site = require 'gluon.site'
local sp = util.subprocess
local unistd = require 'posix.unistd' local unistd = require 'posix.unistd'
local wait = require 'posix.sys.wait' local wait = require 'posix.sys.wait'
@ -75,12 +76,12 @@ function pw2.cfgvalue()
end end
local function set_password(password) local function set_password(password)
local options = {[unistd.STDIN_FILENO] = util.subprocess.PIPE, local options = {stdin = sp.PIPE,
[unistd.STDOUT_FILENO] = util.subprocess.DEVNULL, stdout = sp.DEVNULL,
[unistd.STDERR_FILENO] = util.subprocess.DEVNULL} stderr = sp.DEVNULL}
local pid, pipe = util.subprocess.popen('passwd', {[0] = 'passwd'}, options) local pid, pipe = sp.popen('passwd', {[0] = 'passwd'}, options)
local inw = pipe[unistd.STDIN_FILENO] local inw = pipe["stdin"]
unistd.write(inw, string.format('%s\n%s\n', password, password)) unistd.write(inw, string.format('%s\n%s\n', password, password))
unistd.close(inw) unistd.close(inw)