NativeServices.RunCommand
Method | RunCommand | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Module | NativeServices | |||||||||||||
Library | Core | |||||||||||||
Action | Execute a command-line. | |||||||||||||
Parameters | | |||||||||||||
| ||||||||||||||
| ||||||||||||||
| ||||||||||||||
NoteCase is not significant. WarningThis parameter is implemented for Windows only; it is allowed but ignored for other platforms. | ||||||||||||||
| ||||||||||||||
| ||||||||||||||
WarningTry to avoid using | ||||||||||||||
| ||||||||||||||
Return values | WarningMany Windows programs set a zero exit code even on failure. WarningIf there is no (captured) output from the program whatsoever, the return value from this method is completely empty. There is not a single row with an empty | |||||||||||||
Examples | Running as the Tachyon.Agent user (LocalSystem usually) NativeServices.RunCommand(CommandLine:"ping 127.0.0.1", SplitLines:true, IgnoreExitCode:true); NativeServices.RunCommand(CommandLine:@cmdRun, SplitLines:true, WorkingDirectory:@fileDir, TimeoutSecs: 10, TimeoutKill: true); AsUser example @users = Users.GetLoggedOnUsers(); @users = select * from @users where SessionState='Active'; NativeServices.RunCommand(CommandLine:"c:\\windows\\notepad.exe", AsUser:@users.Account); | |||||||||||||
Platforms |
| |||||||||||||
Notes | If the Agent is shut down while a command is running (with or without a timeout specified), the command subprocess is detached from the Agent (so that Agent shutdown is not blocked), and the Tachyon instruction's status is set to "execution failed" because Tachyon cannot know the ultimate fate of the command. It is up to the user to decide whether to resubmit the instruction or not when the Tachyon Agent resumes. By default, a long-running instruction will time out. "Long running" is 3600 seconds, i.e. 1 hour. This is to prevent a hanging command from completely blocking the Tachyon Agent, because the Agent has an exclusivity feature for safety such that even if the Agent runs with multiple workers then executing a command prevents any other worker from running an instruction in parallel. (This is because instructions that follow the command might depend on that command having run to completion.) A command hanging indefinitely would completely block the Agent, including any instructions to kill the hanging command's process. If a command really must be run to completion, set Because the Tachyon Agent has multiple workers and so can run a number of instructions in parallel, it is possible that conflicting commands could run at the same time, e.g. each attempting to install software. (Software packages can only usually be installed one at a time.) If this is likely to be a problem, the Agent's " |