Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
Alternative of vscode.window.onDidWriteTerminalData

The vscode.window.onDidWriteTerminalData event cannot be used when publishing extensions for Visual Studio Code. Does anyone know of an alternative method to capture the text and changes from the built-in terminal to handle this information in a variable?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

searching in some places, I checked a NodeJs library called child_process and imported it into my project, after that, I declared a Promise to check the result of the exec method of this library. It was possible to get the execution data and treat it using a regexp to match a text or URL in the terminal.

Example:

function runApp(command) {
  setApplicationProperties();
  outputChannel.show();
  let promise = new Promise(resolve => {
    vscode.window.showInformationMessage(`Running App '${application_name}'...`);   
    let result = child.exec(command, {cwd: getWorkspaceDir()});
    result.stdout.on("data", (data) => {
        outputFilter = data;
        infoCatcher = outputFilter.match(/\w.+/gi);
        if(infoCatcher != null) outputChannel.append(`${infoCatcher[0]}\n`);
        urlCatcher = outputFilter.match(/(http|https)?:\/\/.+/gi);
        if(urlCatcher != null) vscode.env.openExternal(vscode.Uri.parse(urlCatcher[0]));
        resolve(); 
    });
});
return promise;

}

Thanks for the help.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda