A system command executed via the IO.popen
method.
Signature:
popen([env,] cmd, mode="r" [, opt]) -> io
popen([env,] cmd, mode="r" [, opt]) {|io| block } -> obj
IO.popen
does different things based on the value of cmd
:
"-" : fork
commandline : command line string which is passed to a shell
[env, cmdname, arg1, ..., opts] : command name and zero or more arguments (no shell)
[env, [cmdname, argv0], arg1, ..., opts] : command name, argv[0] and zero or more arguments (no shell)
(env and opts are optional.)
Examples:
IO.popen("cat foo.txt | tail")
IO.popen({some_env_var: "123"}, "cat foo.txt | tail")
IO.popen(["cat", "foo.txt"])
IO.popen([{some_env_var: "123"}, "cat", "foo.txt"])
IO.popen([["cat", "argv0"], "foo.txt"])
IO.popen([{some_env_var: "123"}, ["cat", "argv0"], "foo.txt"])
Ruby documentation: https://docs.ruby-lang.org/en/3.1/IO.html#method-c-popen
Import path
import codeql.ruby.frameworks.core.IO
Direct supertypes
Predicates
getAnArgument | Gets an argument to this execution that specifies the command or an argument to it. |
isShellInterpreted | Holds if a shell interprets |
Inherited predicates
asCallable | Gets the callable corresponding to this block, lambda expression, or call to | from Node |
asExpr | Gets the expression corresponding to this node, if any. | from Node |
asParameter | Gets the parameter corresponding to this node, if any. | from Node |
backtrack | Starts backtracking from this node using API graphs. | from Node |
getALocalSource | Gets a local source node from which data may flow to this node in zero or more local data-flow steps. | from Node |
getAPredecessor | Gets a data flow node from which data may flow to this node in one local step. | from Node |
getASuccessor | Gets a data flow node to which data may flow from this node in one local step. | from Node |
getConstantValue | Gets the constant value of this expression, if any. | from Node |
getEnclosingMethod | Gets the enclosing method, if any. | from Node |
getLocation | Gets the location of this node. | from Node |
hasLocationInfo | Holds if this element is at the specified location. The location spans column | from Node |
toString | Gets a textual representation of this node. | from Node |