We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0ab08aa + 8293fae commit 92306f6Copy full SHA for 92306f6
1 file changed
pkgm.ts
@@ -263,12 +263,14 @@ async function query_pkgx(
263
let cmd = needs_sudo_backwards ? "/usr/bin/sudo" : pkgx;
264
if (needs_sudo_backwards) {
265
if (!Deno.env.get("SUDO_USER")) {
266
- if (!Path.root.join(".dockerenv").isFile()) { // if we're running in Docker then screw it, it's fine
267
- //TODO if no SUDO_USER then probs we are a root shell, if so set PKGX_DIR and skip hard link step
268
- throw new Error("SUDO_USER not set, cannot install as root");
269
- } else {
270
- cmd = pkgx;
+ if (Deno.uid() == 0) {
+ console.error(
+ "%cwarning",
+ "color:yellow",
+ "installing as root; installing via `sudo` is preferred",
271
+ );
272
}
273
+ cmd = pkgx;
274
} else {
275
args.unshift("-u", Deno.env.get("SUDO_USER")!, pkgx);
276
0 commit comments