@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.js +16 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antoncallahan/aws-user-helper",
3
- "version": "1.12.3",
3
+ "version": "1.12.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/setup.js CHANGED
@@ -1,26 +1,20 @@
1
- const { execSync } = require('child_process');
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
- try {
9
- execSync(
10
- `powershell -NoProfile -Command "` +
11
- `$ErrorActionPreference = 'Stop'; ` +
12
- `try { ` +
13
- `$p = Start-Process -FilePath '${nodePath}' -ArgumentList '${targetScript}' -Verb RunAs -PassThru -Wait; ` +
14
- `Write-Host ('EXIT CODE: ' + $p.ExitCode); ` +
15
- `exit $p.ExitCode ` +
16
- `} catch { ` +
17
- `Write-Host ('CAUGHT ERROR: ' + $_.Exception.Message); ` +
18
- `exit 1 ` +
19
- `}"`,
20
- { stdio: 'inherit' }
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
+ );