elevated ( command replace? win-console? posix-graphical? -- process )
Elevated permissions API

Prev:elevate ( win-console? posix-graphical? -- )
Next:lowered ( -- )


Vocabulary
elevate

Inputs
commandan array or a string
replace?a boolean
win-console?a boolean
posix-graphical?a boolean


Outputs
processa process


Word description
Spawn a process from the command command with superuser (administrator) privileges. If the calling process does not already have superuser privileges, it will request them by a number of platform-specific methods.

If replace? is t, the calling Factor process will be replaced with the command (but see Notes).

windows: if win-console? is t, a new console window will always be spawned for the resulting process, regardless of replace?.

unix: if posix-graphical? is t, a graphical password method will be attempted before sudo.

If the calling process is already run as superuser, nothing happens. The input command is left on the stack, placed into a process inside an array.

Notes
On windows, replace? has the effect of ending (with exit) the calling Factor process after spawning the command because Windows provides no way to replace a running process' image, like exec does in POSIX.
On POSIX (unix), replace? does not cause a graceful shutdown of the calling Factor VM or thread. Instead, the entire executable program image will be immediately replaced in memory by the new command prefixed by a privilege elevation strategy. For more information, see exec-with-path and the Unix man page for execvp (exec) in section 3.
Elevate bugs and caveats details problems and pitfalls of this word.


Errors
elevated-failed when all strategies fail.

When replace? is t:any errors thrown by run-process.

Definition


HOOK: elevated os
( command replace? win-console? posix-graphical? -- process )


Methods