mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Fixed ShellJS.exec() definition in .d.ts.
This commit is contained in:
Vendored
+36
-21
@@ -8,6 +8,8 @@
|
||||
|
||||
declare module "shelljs"
|
||||
{
|
||||
import child = require("child_process");
|
||||
|
||||
/**
|
||||
* Changes to directory dir for the duration of the script
|
||||
* @param {string} dir Directory to change in.
|
||||
@@ -434,31 +436,44 @@ declare module "shelljs"
|
||||
* Object containing environment variables (both getter and setter). Shortcut to process.env.
|
||||
*/
|
||||
export var env: { [key: string]: string };
|
||||
|
||||
/*
|
||||
|
||||
// Not yet implemented due to implementation issues (constant overloads and return types).
|
||||
// See: https://github.com/arturadib/shelljs#execcommand--options--callback
|
||||
|
||||
export function exec(command: string, options: ExecOptions, callback: (code: number, output: string) => any): any;
|
||||
export function exec(command: string, options: ExecOptions): any;
|
||||
|
||||
interface ExecOptions
|
||||
{
|
||||
silent: boolean;
|
||||
async: boolean;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The commadn to execute.
|
||||
* @return {ExecReturnValue} Returns an object containing the return code and output as string.
|
||||
* @param {string} command The command to execute.
|
||||
* @return {ExecOutputReturnValue} Returns an object containing the return code and output as string.
|
||||
*/
|
||||
export function exec(command: string): ExecReturnValue;
|
||||
export function exec(command: string): ExecOutputReturnValue;
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @param {ExecOptions} options Silence and synchronous options.
|
||||
* @return {ExecOutputReturnValue | child.ChildProcess} Returns an object containing the return code and output as string, or if {async:true} was passed, a ChildProcess.
|
||||
*/
|
||||
export function exec(command: string, options: ExecOptions): ExecOutputReturnValue | child.ChildProcess;
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @param {ExecOptions} options Silence and synchronous options.
|
||||
* @param {ExecCallback} callback Receives code and output asynchronously.
|
||||
*/
|
||||
export function exec(command: string, options: ExecOptions, callback: ExecCallback): child.ChildProcess;
|
||||
/**
|
||||
* Executes the given command synchronously.
|
||||
* @param {string} command The command to execute.
|
||||
* @param {ExecCallback} callback Receives code and output asynchronously.
|
||||
*/
|
||||
export function exec(command: string, callback: ExecCallback): child.ChildProcess;
|
||||
|
||||
interface ExecReturnValue
|
||||
export interface ExecCallback {
|
||||
(code: number, output: string): any;
|
||||
}
|
||||
|
||||
export interface ExecOptions {
|
||||
silent?: boolean;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
export interface ExecOutputReturnValue
|
||||
{
|
||||
code: number;
|
||||
output: string;
|
||||
|
||||
Reference in New Issue
Block a user