@antoncallahan/aws-user-helper 1.12.3 → 1.12.4
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 +13 -25
package/package.json
CHANGED
package/setup.js
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const nodePath = process.execPath.replace(/\\/g, '\\\\');
|
|
2
|
+
const targetScript = path.join(__dirname, 'installer.js').replace(/\\/g, '\\\\');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
}
|
|
4
|
+
execSync(
|
|
5
|
+
`powershell -NoProfile -Command "` +
|
|
6
|
+
`$ErrorActionPreference = 'Stop'; ` +
|
|
7
|
+
`try { ` +
|
|
8
|
+
`$p = Start-Process -FilePath '${nodePath}' -ArgumentList @('${targetScript}') -Verb RunAs -PassThru -Wait; ` +
|
|
9
|
+
`exit $p.ExitCode ` +
|
|
10
|
+
`} catch { ` +
|
|
11
|
+
`exit 1 ` +
|
|
12
|
+
`}"`,
|
|
13
|
+
{ windowsHide: true, stdio: 'pipe' }
|
|
14
|
+
);
|