File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -263,12 +263,14 @@ async function query_pkgx(
263263 let cmd = needs_sudo_backwards ? "/usr/bin/sudo" : pkgx ;
264264 if ( needs_sudo_backwards ) {
265265 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 ;
266+ if ( Deno . uid ( ) == 0 ) {
267+ console . error (
268+ "%cwarning" ,
269+ "color:yellow" ,
270+ "installing as root; installing via `sudo` is preferred" ,
271+ ) ;
271272 }
273+ cmd = pkgx ;
272274 } else {
273275 args . unshift ( "-u" , Deno . env . get ( "SUDO_USER" ) ! , pkgx ) ;
274276 }
You can’t perform that action at this time.
0 commit comments