mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-25 12:16:37 +00:00
Fix windows elevation module import
Change-type: patch
This commit is contained in:
parent
18fb9c9de3
commit
59230a0f9e
@ -19,6 +19,7 @@
|
|||||||
"nodeGypRebuild": true,
|
"nodeGypRebuild": true,
|
||||||
"afterPack": "./afterPack.js",
|
"afterPack": "./afterPack.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
"build/Release/elevator.node",
|
||||||
"generated",
|
"generated",
|
||||||
"lib/shared/catalina-sudo/sudo-askpass.osascript.js",
|
"lib/shared/catalina-sudo/sudo-askpass.osascript.js",
|
||||||
"lib/gui/app/index.html",
|
"lib/gui/app/index.html",
|
||||||
|
@ -6,6 +6,7 @@ nodeGypRebuild: true
|
|||||||
publish: null
|
publish: null
|
||||||
afterPack: "./afterPack.js"
|
afterPack: "./afterPack.js"
|
||||||
files:
|
files:
|
||||||
|
- build/Release/elevator.node
|
||||||
- generated
|
- generated
|
||||||
- lib/shared/catalina-sudo/sudo-askpass.osascript.js
|
- lib/shared/catalina-sudo/sudo-askpass.osascript.js
|
||||||
- lib/gui/app/index.html
|
- lib/gui/app/index.html
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017 resin.io
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
const path = require('path')
|
|
||||||
const bindings = require('bindings')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Load a native module
|
|
||||||
* @function
|
|
||||||
* @public
|
|
||||||
*
|
|
||||||
* @param {String} moduleName - native module name
|
|
||||||
* @returns {Object} native module
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const elevator = nativeModule.load('elevator');
|
|
||||||
*/
|
|
||||||
exports.load = (moduleName) => {
|
|
||||||
return bindings({
|
|
||||||
bindings: moduleName,
|
|
||||||
|
|
||||||
// eslint-disable-next-line camelcase
|
|
||||||
module_root: path.join(__dirname, '..', '..')
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const bindings = require('bindings')
|
||||||
const Bluebird = require('bluebird')
|
const Bluebird = require('bluebird')
|
||||||
const childProcess = Bluebird.promisifyAll(require('child_process'))
|
const childProcess = Bluebird.promisifyAll(require('child_process'))
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
@ -136,10 +137,9 @@ exports.createLaunchScript = (command, argv, environment) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const elevateScriptWindows = async (path) => {
|
const elevateScriptWindows = async (path) => {
|
||||||
// './nativeModule' imported here as it only exists on windows
|
// 'elevator' imported here as it only exists on windows
|
||||||
// TODO: replace this with sudo-prompt once https://github.com/jorangreef/sudo-prompt/issues/96 is fixed
|
// TODO: replace this with sudo-prompt once https://github.com/jorangreef/sudo-prompt/issues/96 is fixed
|
||||||
const nativeModule = require('./native-module')
|
const elevateAsync = promisify(bindings({ bindings: 'elevator' }).elevate)
|
||||||
const elevateAsync = promisify(nativeModule.load('elevator').elevate)
|
|
||||||
|
|
||||||
// '&' needs to be escaped here (but not when written to a .cmd file)
|
// '&' needs to be escaped here (but not when written to a .cmd file)
|
||||||
const cmd = [ 'cmd', '/c', escapeParamCmd(path).replace(/&/g, '^&') ]
|
const cmd = [ 'cmd', '/c', escapeParamCmd(path).replace(/&/g, '^&') ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user