Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!