temp
This commit is contained in:
20
packages/webshell/webshell-node/src/index.ts
Normal file
20
packages/webshell/webshell-node/src/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import os from 'node:os';
|
||||
import pty, { IPty } from 'node-pty';
|
||||
|
||||
const shell: string = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
|
||||
console.log(shell);
|
||||
const ptyProcess: IPty = pty.spawn(shell, [], {
|
||||
name: 'xterm-color',
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
cwd: process.env.HOME || '',
|
||||
env: process.env as NodeJS.ProcessEnv,
|
||||
});
|
||||
|
||||
ptyProcess.onData((data: string) => {
|
||||
process.stdout.write(data);
|
||||
});
|
||||
|
||||
ptyProcess.write('ls\r');
|
||||
ptyProcess.resize(100, 40);
|
||||
ptyProcess.write('ls\r');
|
||||
Reference in New Issue
Block a user