The table `OsCommands` holds one row per operating-system command started on behalf of the script, such as by a [[Host]] statement. It reports what was started and how it ended, not what it printed.
The columns of the table `OsCommands` are:
- `ID` (`int64`): identifier of the command, unique within the process and ascending in order of starting.
- `RUN_ID` (`int64`): identifier of the run the command belongs to, referring to [[Runs]].
- `STATEMENT_ID` (`int64`): identifier of the statement which started the command, referring to [[StatementExecutions]].
- `COMMAND` (`varchar2`): the program started.
- `ARGUMENTS` (`varchar2`): the arguments handed over to the program.
- `WORKING_DIRECTORY` (`varchar2`): the folder the program was started in.
- `STARTED_UTC` (`datetime`): moment at which the command started (UTC).
- `ENDED_UTC` (`datetime`): moment at which the command ended (UTC). Empty while the command is busy.
- `DURATION_MS` (`double`): duration of the command in milliseconds.
- `MAX_DURATION_MS` (`double`): time in milliseconds the command was allowed to take. Empty when no limit applied.
- `EXIT_CODE` (`int32`): exit code the command ended with. An exit code other than zero conventionally signals failure.
- `TIMED_OUT` (`boolean`): whether the command was stopped because it exceeded `MAX_DURATION_MS`.
- `STDOUT_BYTES` (`int64`): number of bytes the command wrote to standard output.
- `STDERR_BYTES` (`int64`): number of bytes the command wrote to standard error.
The command line is registered as it was handed to the operating system. A command line which carries a password or another secret is therefore retained in full, so pass such a value through a file or an environment variable rather than as an argument.
The following example lists the commands which failed or were stopped:
```sql
select ocd.id
, ocd.command
, ocd.arguments
, ocd.exit_code
, ocd.timed_out
, ocd.duration_ms
from OsCommands@script ocd
where ocd.exit_code != 0
or ocd.timed_out = true
order
by ocd.id
```