File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -257,13 +257,18 @@ async function query_pkgx(
257257 set ( "PKGX_DIST_URL" ) ;
258258
259259 const needs_sudo_backwards = install_prefix ( ) . string == "/usr/local" ;
260- const cmd = needs_sudo_backwards ? "/usr/bin/sudo" : pkgx ;
260+ let cmd = needs_sudo_backwards ? "/usr/bin/sudo" : pkgx ;
261261 if ( needs_sudo_backwards ) {
262262 if ( ! Deno . env . get ( "SUDO_USER" ) ) {
263- //TODO if no SUDO_USER then probs we are a root shell, if so set PKGX_DIR and skip hard link step
264- throw new Error ( "SUDO_USER not set, cannot install as root" ) ;
263+ if ( ! Path . root . join ( ".dockerenv" ) . isFile ( ) ) { // if we're running in Docker then screw it, it's fine
264+ //TODO if no SUDO_USER then probs we are a root shell, if so set PKGX_DIR and skip hard link step
265+ throw new Error ( "SUDO_USER not set, cannot install as root" ) ;
266+ } else {
267+ cmd = pkgx ;
268+ }
269+ } else {
270+ args . unshift ( "-u" , Deno . env . get ( "SUDO_USER" ) ! , pkgx ) ;
265271 }
266- args . unshift ( "-u" , Deno . env . get ( "SUDO_USER" ) ! , pkgx ) ;
267272 }
268273
269274 const proc = new Deno . Command ( cmd , {
You can’t perform that action at this time.
0 commit comments