Module: ko/shell

The Shell module allows you to interact with the shell and processes

Members


require("ko/shell").spawn

Alias for run

Methods


require("ko/shell").exec(command, opts, callback)

Execute an encoded command

Example
opts =
{
     cwd:"", // set current working dir. Default to Place Pane root
     env:{}, // object containing current system variables including ones set in Komodo prefs
     argv:[], // an array or arugments to be passed to the command
     runIn: "", // Where to out stdout. eg. "hud"
}
Parameters:
Name Type Description
command String

The command to execute

opts Object

Options object

callback function

The callback function. When called it will have the following 3 arguments: error Error, stdoutString | Buffer, stderr String | Buffer.

Returns:
Type
Process

require("ko/shell").getCwd()

Get the current working directory, based on the places pane

Returns:
Type
String

require("ko/shell").getEnv()

Get the configured environment variables

Returns:
Type
Object

require("ko/shell").lookup(command, env)

Look up the location of the given executable

Parameters:
Name Type Description
command String

The executable

env Object

The environment to work with, defaults to getEnv()

Returns:
Type
String | Boolean

require("ko/shell").parseTable()

Parses table information into a JS array

Example:

FOO BAR val1a val2a val1b val2a

Results in:

[ {FOO: val1a, BAR: val2a}, {FOO: val1b, BAR: val2b} ]

Returns:
Type
Array

require("ko/shell").run(binary, args, opts)

Run a shell command

Example
opts =
{
     cwd:"", // set current working dir. Default to Place Pane root
     env:{}, // object containing current system variables including ones set in Komodo prefs
}
Parameters:
Name Type Description
binary String

Executable

args Array

Arguments

opts Object

cwd, env, ..

Returns:
Type
Process

require("ko/shell")._showOutputInHud(process, command)

Show output for the given process in a HUD window

Parameters:
Name Type Description
process Process

The process to show output for

command String

The (humanly readable) command that was used to start this process