Because this function returns the stdout as it's first return value, it is not quite a drop-in replacement for os.execute.Setting with_user_env to true does incur noticeable overhead, so it should only be used if necessary (to set the path or other environment variables).If the command was killed by a signal, then this number corresponds to the signal type that caused the command to terminate. rc - if the command exited of its own accord, then this number will represent the exit code (usually 0 for success, not 0 for an error, though this is very command specific, so check man pages when there is a question).type - a string value of "exit" or "signal" indicating whether the command terminated of its own accord or if it was terminated by a signal (killed, segfault, etc.).status - true if the command terminated successfully or nil otherwise.May contain an extra terminating new-line (\n). output - the stdout of the command as a string.with_user_env - optional boolean argument which if provided and is true, executes the command in the users login shell as an "interactive" login shell causing the user's local profile (or other login scripts) to be loaded first.command - a string containing the shell command to execute.Runs a shell command, optionally loading the users shell environment first, and returns stdout as a string, followed by the same result codes as os.execute would return. Hs.execute(command) -> output, status, type, rc this function is added to the lua coroutine library as coroutine.applicationYield as an alternative name.Įxtensions/_coresetup/_a line 106. unlike coroutine.yield, this function does not allow the passing of (new) information to or from the coroutine while it is running this function is to allow long running tasks to yield time to the Hammerspoon application so other timers and scheduled events can occur without requiring the programmer to add code for an explicit resume.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |