shell.d.ts 727 B

12345678910111213141516171819202122
  1. /// <reference types="node" />
  2. import { StdioOptions } from 'child_process';
  3. export declare class ShellError extends Error {
  4. constructor(message: string);
  5. }
  6. interface ICommonShellOptions {
  7. cwd?: string;
  8. env?: NodeJS.ProcessEnv;
  9. stdio?: StdioOptions;
  10. timeout?: number;
  11. }
  12. export interface IShellOptions extends ICommonShellOptions {
  13. async?: boolean;
  14. }
  15. declare function shell(command: string, options: IShellOptions & {
  16. async: true;
  17. }): Promise<string | null>;
  18. declare function shell(command: string, options?: IShellOptions & {
  19. async?: false | null;
  20. }): string | null;
  21. declare function shell(command: string, options?: IShellOptions): Promise<string | null> | string | null;
  22. export default shell;