test fro node-pty
This commit is contained in:
		@@ -1,3 +1 @@
 | 
			
		||||
import { useContextKey } from '@kevisual/use-config/context';
 | 
			
		||||
 | 
			
		||||
export { log, getLogPath } from './logger.ts';
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,8 @@ import { checkShowPage } from './window/page/index.ts';
 | 
			
		||||
import { closeProcess, createProcess } from './process/index.ts';
 | 
			
		||||
import { getElectronResourcePath, isMac } from './system/env.ts';
 | 
			
		||||
import { checkForUpdates } from './updater/index.ts';
 | 
			
		||||
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
const __filename = fileURLToPath(import.meta.url);
 | 
			
		||||
const __dirname = path.dirname(__filename);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								src/main/terminal/pty.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/main/terminal/pty.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
import * as pty from 'node-pty';
 | 
			
		||||
 | 
			
		||||
export function createPty(cmd: string) {
 | 
			
		||||
  const ptyProcess = pty.spawn(cmd, [], {
 | 
			
		||||
    name: 'xterm-color',
 | 
			
		||||
    cols: 80,
 | 
			
		||||
    rows: 30,
 | 
			
		||||
    cwd: process.env.HOME,
 | 
			
		||||
    env: process.env,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  ptyProcess.onData((data) => {
 | 
			
		||||
    process.stdout.write(data);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  ptyProcess.write('ls\r');
 | 
			
		||||
  ptyProcess.resize(100, 40);
 | 
			
		||||
  ptyProcess.write('ls\r');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
createPty('ls');
 | 
			
		||||
		Reference in New Issue
	
	Block a user