Skip to content

Commit

Permalink
fix: 修复终端可用
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Jan 30, 2022
1 parent 08971b8 commit 4b427c2
Show file tree
Hide file tree
Showing 19 changed files with 1,851 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ tmp/
mew/
node_modules
test/mini-ci
crash-server
crash-server
build
9 changes: 6 additions & 3 deletions docker/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fail() {

echo "start"
python --version
node --version
echo "docker node version: $( node --version )"
# export http_proxy="http://192.168.249.236:7890"

ACTION_MODE=$( export ACTION_MODE )
Expand Down Expand Up @@ -54,8 +54,8 @@ apt-get clean; # 清空缓存
apt-get update; # 更新
apt-get install -y libx11-dev libxkbfile-dev p7zip-full

npm install -g npm
npm install -g node-gyp
echo "=====安装node-gyp nw-gyp===="
npm install -g npm node-gyp nw-gyp
node-gyp install
node-gyp list

Expand All @@ -70,4 +70,7 @@ node-gyp list
# end test

cd /workspace
# rm -rf package.nw node nwjs
#
# exec ./tools/rebuild-node-modules 0.53.1
exec ./tools/setup-wechat-devtools-bash
6 changes: 5 additions & 1 deletion docs/DEBUG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ devtools_app.html并没有被加载
| wechat-tool | nw.js | node |
|-------------|-------|------|
|1.03.2006090 |0.39.3 |12.6.0|
|1.05.2201210 |0.49.3 |13.14.0|
|1.05.2201210 |0.49.3 |13.14.0|

# 终端测试

return r.handleEvent ? r.handleEvent.apply(this, o) : r.apply(this, o)
19 changes: 19 additions & 0 deletions docs/Terminal.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
文件`package.nw/js/libs/vseditor/bundled/editor.bundled.js`

使用`console.warn`进行调试输出

`this._processManager.createProcess(this._shellLaunchConfig,this._cols,this._rows,this._accessibilityService.isScreenReaderOptimized())`

`const s=await this._process.start();`处崩溃

`setupPtyProcess`崩溃

const test = (await Promise.resolve().then(()=>i(1645)))
i ---- Array
[
"spawn"
"fork"
"createTerminal"
"open"
"native"
]
16 changes: 16 additions & 0 deletions test/node-pty/code/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "nwjs",
"request": "launch",
"name": "Launch NWjs",
"nwjsVersion": "0.60.0",
"webRoot": "${workspaceFolder}",
"reloadAfterAttached": true
}
]
}
36 changes: 36 additions & 0 deletions test/node-pty/code/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node.js 9999
<script>
document.write(process.version)
console.log(123)

var os = require('os');
var pty = require('node-pty');

var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
console.log(456)
var ptyProcess = pty.spawn(shell, [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env
});

ptyProcess.onData(function(data) {
process.stdout.write(data);
});

ptyProcess.write('ls\r');
ptyProcess.resize(100, 40);
ptyProcess.write('ls\r');
</script>.
<script scr=index.js></script>
</body>
</html>
22 changes: 22 additions & 0 deletions test/node-pty/code/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
console.log("index.js")
var os = require('os');
var pty = require('node-pty');

console.info(process.versions)
var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';

var ptyProcess = pty.spawn(shell, [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env
});

ptyProcess.onData(function(data) {
process.stdout.write(data);
});

ptyProcess.write('ls\r');
ptyProcess.resize(100, 40);
ptyProcess.write('ls\r');
Loading

1 comment on commit 4b427c2

@msojocs
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4

Please sign in to comment.