The command environment

When Oda runs a command on your computer, it does so in a shell it controls: a shell chosen for your computer, a set of limits on time and output, and a small set of variables every command receives. This page describes that environment. How the commands themselves appear in the chat, with their cards and result markers, is on Shell commands.

The shell that runs your commands

Oda uses the shell that fits your computer:

ComputerShell
WindowsPowerShell
macOS and Linuxbash

On Windows, Oda looks for PowerShell and uses the first candidate it can run:

  1. A path configured for Oda, when one is set.
  2. The standard PowerShell 7 install folder.
  3. The folders on your PATH.
  4. Windows PowerShell 5.1, as a last resort.

When the configured path changes, Oda looks again for later commands; no restart is needed.

Limits every command runs under

Oda applies the same limits to each command, whichever shell runs it:

LimitDefaultWhat it covers
Time per commandtwo minutesA single command may be given more time, up to ten minutes.
Output kept in the reply64,000 bytesA command that produces more has its full text saved to a file on your computer, up to 64 MiB, and Oda can read the text from there.
Grace when stoppingthree secondsA stopped command gets this long to end before it is ended by force.

The time limit and the output cap can be changed from the Plugins page; see Shell settings. Changes apply to later commands without restarting Oda. A value Oda cannot use is caught when the next command runs, not when it is saved.

What every command receives

Every command runs with a plain, predictable setup:

Every command also receives these managed variables, so your own scripts can find the same facts Oda works with:

VariableWhat it holds
DATAMIND_HOMEThe folder Oda keeps its own data in. It resolves from an environment value when one is set; otherwise it defaults to a folder inside your user folder. See Oda's home folder and settings files.
DATAMIND_SHELLSet to 1; marks a command that runs inside Oda's shell.
DATAMIND_SESSION_IDThe id of the chat the command belongs to; it is left out for commands that are not run for a chat.
DATAMIND_PROFILEThe name of the Oda profile in use, when one is set.
DATAMIND_PROFILE_DIRThe folder of that profile.

Questions, answered

Which shell does Oda run commands in?

PowerShell on Windows; bash on macOS and Linux. Oda loads exactly one shell engine, so commands never run through a mix of shells.

How long may a command run?

Two minutes by default. Oda may give a single command more time, up to ten minutes. What happens when a command reaches its limit is on Shell commands.

Can I change the time limit or the output cap?

Yes. Open the Plugins page and change them there; the changes apply to later commands without a restart. See Live plugin settings for how settings changes reach a running Oda.

What happens if a saved limit is not a usable number?

The save is accepted; the next command fails instead of running, with a message about the value. Open the Plugins page and set a usable value.

What variables does every command receive?

DATAMIND_HOME (Oda's data folder), DATAMIND_SHELL (set to 1), DATAMIND_SESSION_ID (the chat the command belongs to), and DATAMIND_PROFILE and DATAMIND_PROFILE_DIR when a profile is set. Use them in your own scripts to find the same facts Oda works with.

Why is a command's output plain, with no colours?

Oda turns colour and paging off so results are readable text: NO_COLOR=1, PAGER=cat and GIT_PAGER=cat are set, bash also sets TERM=dumb, and PowerShell commands have their output pinned to UTF-8.

How does Oda find PowerShell on my computer?

In order: a configured path, the standard PowerShell 7 install folder, your PATH, then Windows PowerShell 5.1 as a last resort. Change the configured path and Oda looks again for later commands.

Is a stopped command ended immediately?

No. It gets three seconds to end by itself; a command that has not ended after that is stopped by force.