import { IHandlerParameters } from "@zowe/imperative" ; import { Shell , SshBaseHandler } from "@zowe/zos-uss-for-zowe-sdk" ; export class implements ICommandHandler export default class Handler extends SshBaseHandler { private parameters : IHandlerParameters ; public async processCmd ( commandParameters ) { let rc ; this . parameters = commandParameters ; if ( commandParameters . arguments . cwd ) { rc = await Shell . executeSshCwd ( this . mSession , commandParameters . arguments . command , commandParameters . arguments . cwd , this . handleStdout . bind ( this ) ) ; } else { rc = await Shell . executeSsh ( this . mSession , commandParameters . arguments . command , this . handleStdout . bind ( this ) ) ; } commandParameters . response . data . setExitCode ( rc ) ; } public handleStdout ( data ) { this . parameters . response . console . log ( Buffer . from ( data ) ) ; } }