OS Command Properties

Index of All Documentation » Wing Pro Reference Manual » OS Commands Tool »

Items added to the OS Commands tool can be configured to run within a particular environment using the dialog shown when the item is added from the OS Commands tool or by selecting an item and using the Edit item in the Options menu.

There are three types of OS Commands: (1) Command Lines, which are executed in the environment configured in the OS Command itself (2) Python files, which are executed in the environment configured in their File Properties, and (3) Named Entry Points, which are executed in the environment configured by the selected Named Entry Point.

Shared Properties

All OS Command types share the following configurable properties:

Title -- This is the user-assigned title to use for the command. If not set, the command line or file name is shown instead.

I/O Encoding -- This is the encoding to use for text sent to and received from the sub-process.

Key Binding -- This field can be used to assign a key binding to the command. Press the keys desired while focus is in the field. Multi-key sequences may be used if pressed within a few seconds of each other. To replace an incorrect value, wait briefly before retrying your binding. To reset the value to blank (no key binding), select all text and press Backspace or Delete.

Raise OS Commands when executed -- This option causes the OS Commands tool to be shown whenever this command is executed. When disabled, the tool will not be brought to front.

Auto-save files before execution -- Enable this to automatically save any unsaved changes in open files before the command is executed.

Use pseudo TTY -- This option is only available on Linux and OS X. When set, Wing runs the subprocess in a pseudo tty and tries to (minimally) emulate how the command would work in a shell. Many of the ANSI escape sequences are not supported, but the basics should work. For some commands, adding options can help it to work better in the OS Commands tool. For example, bash -norc works better than bash if you have bash using colors, and ipython -colors NoColor works better than ipython alone.

Line mode -- This option is only available on Linux and OS X (on Windows, all I/O will be done line by line). When it is unchecked, Wing will enter raw mode and send every keystroke to the subprocess, rather than collecting input line by line. Often, but not always, when a pseudo TTY is being used then line mode should be disabled. Some experimentation may be required to determine the best settings.

Hostname -- In Wing Pro, command line style OS Commands can specify a configured remote host as the place to run the command line. This is done under the Environment tab. See Remote Hosts for details. For Python file and Named Entry Point style OS Commands, the hostname on which the command will execute is determined by the location of the Python file.

Additional Properties for Command Lines

In command lines, use $(ENV) or ${ENV} to insert values from the environment or from the special variables enumerated in Environment Variable Expansion. These values will be empty if undefined.

Note that the commands are executed on their own and not in a shell, so any commands that are built into the shell cannot be used here. For example, on Windows dir and some others are built-in commands so cannot be used directly; however, the form cmd /c dir will work in this case. On Linux, invoking bash directly may be necessary in similar cases.

The Environment tab provided for command lines allows specifying the Initial Directory, Python Path, and Environment, which act the same as the corresponding values configurable in Project Properties.

Test Execute

While editing command properties, the Test Execute button can be used to try executing with the current settings. A temporary entry is added to the OS Commands tool, and removed again after the command properties dialog is closed.