import * as carrier from 'carrier' ; import * as child from 'child_process' ; import { OutputChannel , TextEditor , TextEditorEdit , window , workspace } from 'vscode' ; import { Server } from './server' ; let batchOutputChannel ; export function batchExecuteFile ( server , editor , edit , args ) { batchOutputChannel = batchOutputChannel || window . createOutputChannel ( 'Lean: Batch File Output' ) ; const fileName = editor . document . fileName ; const executablePath = server . executablePath ; const lean = child . spawn ( executablePath , [ fileName ] , { cwd : workspace . rootPath , env : { } } ) ; batchOutputChannel . clear ( ) ; carrier . carry ( lean . stdout , ( line ) => { batchOutputChannel . appendLine ( line ) ; } ) ; carrier . carry ( lean . stderr , ( line ) => { batchOutputChannel . appendLine ( line ) ; } ) ; lean . on ( 'close' , ( code ) => { } ) ; batchOutputChannel . show ( true ) ; }