You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
I have a question about my error: this._ptyNative.startProcess is not a function #749
I'm making a plugin for obsidian, and I have the following error when running it.
plugin:sample-plugin:8124 TypeError: this._ptyNative.startProcess is not a function
at new WindowsPtyAgent2 (plugin:sample-plugin:7252:36)
at new WindowsTerminal2 (plugin:sample-plugin:7557:26)
at spawn2 (plugin:sample-plugin:7988:14)
at new ExampleView (plugin:sample-plugin:8120:51)
at eval (plugin:sample-plugin:8165:17)
at t.<anonymous> (app.js:1:2113665)
at app.js:1:237228
at Object.next (app.js:1:237333)
at app.js:1:236249
at new Promise (<anonymous>)
Here is the code I implemented:
import{ItemView,WorkspaceLeaf}from'obsidian';import{Terminal}from'@xterm/xterm';import{IPty,spawn}from'node-pty';import'@xterm/xterm/css/xterm.css';exportconstVIEW_TYPE_EXAMPLE='example-view';exportclassExampleViewextendsItemView{term: Terminal;ptyProcess: IPty;constructor(leaf: WorkspaceLeaf){super(leaf);try{this.ptyProcess=spawn('cmd.exe',[],{name: 'xterm-color'});}catch(error){console.error(error)}this.term=newTerminal();}getViewType(){returnVIEW_TYPE_EXAMPLE;}getDisplayText(){return'Example view';}asynconOpen(){constcontentEl=this.containerEl.children[1].createDiv({cls: 'html-terminal'});this.term.open(contentEl);this.term.writeln('Welcome from \x1B[1;3;31mxterm.js\x1B[0m');this.term.write(' $ ');try{this.term.onData(data=>{try{this.ptyProcess?.write(data);}catch(err){console.error('Error writing to pty:',err);}});this.ptyProcess.onData(data=>{this.term.write(data);});}catch(err){console.error(err);}}}
Activity