Revert "Add a fallback to which pkexec
on Linux"
This reverts commit 0e933b77c3
.
This commit is contained in:
parent
2ce0236293
commit
5c743a9658
1 changed files with 3 additions and 12 deletions
15
index.js
15
index.js
|
@ -124,7 +124,9 @@ function LinuxBinary(instance, end) {
|
||||||
// However, gksudo cannot run multiple commands concurrently.
|
// However, gksudo cannot run multiple commands concurrently.
|
||||||
var paths = ['/usr/bin/kdesudo', '/usr/bin/pkexec'];
|
var paths = ['/usr/bin/kdesudo', '/usr/bin/pkexec'];
|
||||||
function test() {
|
function test() {
|
||||||
if (index === paths.length) return which();
|
if (index === paths.length) {
|
||||||
|
return end(new Error('Unable to find pkexec or kdesudo.'));
|
||||||
|
}
|
||||||
var path = paths[index++];
|
var path = paths[index++];
|
||||||
Node.fs.stat(path,
|
Node.fs.stat(path,
|
||||||
function(error) {
|
function(error) {
|
||||||
|
@ -138,17 +140,6 @@ function LinuxBinary(instance, end) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function which() {
|
|
||||||
// Operating system paths are not always predictable.
|
|
||||||
// Fallback to a best-effort search for pkexec.
|
|
||||||
Node.child.exec('which pkexec',
|
|
||||||
function(error, stdout, stderr) {
|
|
||||||
if (error) return end(new Error('Unable to find pkexec or kdesudo.'));
|
|
||||||
var path = stdout.toString('utf-8').trim(); // Remove trailing newline.
|
|
||||||
end(undefined, path);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
test();
|
test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue