Opening Terminal and Passing Commands

I wanted to open a terminal on a button click and pass a set of commands to it. I came across this forum post How to run terminal commands on Theia startup? but I am not clear on lib from which I have to import the TerminalService.

I tried importing it from “@theia/terminal/lib/browser/base/terminal-service” but this doesn’t contain “activateTerminal” function that was mentioned in the forum code. Please let me know what function to import to open the terminal and pass commands to it.

@Sreeranjani thanks for the discussion, the example is quite old as the activateTerminal method no longer exists (removed in 1.21.0):

Instead you can use open as the method previously documented.

Thank you, my bad that I missed to check the version