pty-shell 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export declare class PtyShell implements PtyShellUserMethod {
|
|
|
55
55
|
char_num: number;
|
|
56
56
|
};
|
|
57
57
|
on_call: (data: string) => void;
|
|
58
|
+
on_call_child_raw?: (data: string) => void;
|
|
58
59
|
on_control_cmd: (type: exec_cmd_type, data?: string) => void;
|
|
59
60
|
on_child_kill?: (code: number, pid?: number) => void;
|
|
60
61
|
check_exe_cmd: any;
|
package/dist/index.js
CHANGED
|
@@ -833,6 +833,9 @@ class PtyShell {
|
|
|
833
833
|
this.child = this.node_pty.spawn(exe, params, Object.assign({ name: 'xterm-color', cols: this.cols, rows: this.rows, cwd: this.cwd, useConptyDll: false, useConpty: process.env.NODE_ENV !== "production" ? false : undefined, env: Object.assign(Object.assign({}, process.env), this.env) }, spawn_option));
|
|
834
834
|
this.child.onData((data) => {
|
|
835
835
|
this.on_call(data.toString());
|
|
836
|
+
if (this.on_call_child_raw) {
|
|
837
|
+
this.on_call_child_raw(data);
|
|
838
|
+
}
|
|
836
839
|
});
|
|
837
840
|
this.child.onExit(({ exitCode, signal }) => {
|
|
838
841
|
this.close_child(exitCode);
|
|
@@ -856,11 +859,17 @@ class PtyShell {
|
|
|
856
859
|
this.child.stdout.on('data', (data) => {
|
|
857
860
|
// const v = data.toString(); // 子程序没有换行等符号不会立即输出 有缓冲区
|
|
858
861
|
this.send_and_enter(data.toString());
|
|
862
|
+
if (this.on_call_child_raw) {
|
|
863
|
+
this.on_call_child_raw(data);
|
|
864
|
+
}
|
|
859
865
|
});
|
|
860
866
|
this.child.stderr.on('data', (data) => {
|
|
861
867
|
// const v = data.toString();
|
|
862
868
|
this.send_and_enter(data.toString());
|
|
863
869
|
this.next_not_enter = false; // 下一次的换行输出 上一次没有换行
|
|
870
|
+
if (this.on_call_child_raw) {
|
|
871
|
+
this.on_call_child_raw(data);
|
|
872
|
+
}
|
|
864
873
|
});
|
|
865
874
|
this.child.on('exit', (code) => {
|
|
866
875
|
this.close_child(code);
|