Running and the Console

Running

Press Run on the toolbar, F5 or Ctrl+E. While a run is going, the button reads Stop, and Stop or Shift+F5 ends it. A node busy in code of its own that does not listen for Stop holds it; after three seconds the run is given up, the status line reads The run did not stop and was abandoned., and Run is yours again.

Run runs the graph in front, and the document's entry graph - the one the outline marks entry - when the Document graph itself is in front. So one part of a document is tried on its own by bringing it forward.

What runs depends on the graph:

  • A Flows graph runs its active nodes and everything they depend on, and nothing else.
  • A Function runs every node, from its Input to its Output.
  • A Routine or an Events graph runs from its start, step by step.

When the run ends, the status bar says how it went - how many nodes ran and how long they took, 4 nodes in 266 ms, or what failed. Each node that ran shows the time it took under it, with a preview of what it produced where there is something to show, and the node that failed wears a red border. A run never changes the document; the next run starts from what is on the canvas.

While a Flows graph runs, a strip moves across the top of the canvas and a badge reads Running · 2 of 5 nodes, counting as nodes finish; nodes yet to run are dashed, the one running glows, and each finished one gets a tick.

To see a node's result at full size, select it and press Alt+Enter, or right-click it and choose Open preview in window: it opens in a window of its own. Before a run there is nothing to show, and the status bar says Run the graph first; there is nothing to preview yet.

The Properties panel turns to its Run face, which describes the last run in full: Finished or Failed and how long it took, the problems that stopped it, and its Run log - what it printed.

Active nodes

On a Flows graph, a run starts from the nodes marked Active and runs only what they need. Select a node and press Space to mark it active or not, or use the Active switch in its Properties. The line above the canvas counts them - 1 active · 4 will run - and the nodes a run would not touch are dimmed. A run with nothing active reads Nothing ran (no active nodes).

A node of a Flows graph can show its result under it after a run: the Footer preview switch in its Properties, under Execution, with Output shown to pick which output when it has several. P turns it on and off for the selected nodes. A Preview node shows its value this way from the start.

Cached results

A slow node - one that loads a large file, or renders - can keep its result between runs. Select it and press Shift+Space, or turn on Cache result in its Properties: the next runs reuse what it produced and skip it and everything before it, until something it depends on changes. The status bar counts what was reused - 1 node in 5 ms · 10 reused. Switching it on right after a run keeps that run's result at once. Turn it off and on again to recompute it on purpose, for example when the file it reads has changed.

Reactive mode

Reactive, on the toolbar or F8, runs the document again a moment after every edit that changes what it computes. Turning it on runs the document at once.

The console

What a run prints - Print Line, Print, and anything else that writes - goes to the console dock under the canvas, and the console is a terminal: what a program prints is drawn as a terminal draws it, colours included, and what you type goes to the program where it reads. It holds the program's own output and nothing else - no times, no rows about the run - and what was printed to standard error is red, in its place. The dock stays shut while a run prints quietly: the status bar counts the lines, a dot beside the count says there is something unread, and a short note appears over the canvas. It opens by itself when a run writes to standard error, fails, or waits for you to type something.

Open or close it with Ctrl+`, or by clicking the line count in the status bar.

The console dock open under the canvas after a run, reading 7, with the run's time in its header

The right of the console's header says how the run is doing or how it ended - Running…, Waiting for input, 4 nodes in 266 ms, Run failed: and why, The run was stopped. - with Copy (Copy all) and Clear. Drag across the console to select, double-click a word or triple-click a line; Ctrl+A selects everything and Ctrl+C copies what is selected, and a right-click offers Copy, Copy all, Select all, and Paste while the program runs. The status bar's own message can be copied too: click it.

When a run asks for input

A node such as Read Line waits for a line of text. The dock opens on the console, which takes the keyboard, and the console's header and the status bar read Waiting for input. Type where the program asks, after its prompt, correct the line there with Backspace, the arrows, Home and End, and press Enter to send it. Ctrl+D at the start of a line ends the input. Ctrl+C with nothing selected stops the run, as Shift+F5 does.

A program can also read single keys as they are pressed, colour what it prints, place the cursor and take the whole console for a page of its own: the console nodes Read Key, Key Available, Terminal Width and Terminal Height, Clear Screen, Set Cursor Position, Set Text Colour and Use Alternate Screen do so. While a program reads keys one at a time, Ctrl+A is the program's, and Ctrl+Shift+A selects everything in the console instead.

The other tabs

  • Locals and Call stack show where a paused run is - see Debugging.
  • Search (Ctrl+F) finds the document's graphs, nodes by title, name or value, members, comments and groups.
  • References lists every node that reads, sets or calls a member: right-click a data member's node, or a Get or a Set, and choose Find All References.