Skip to content

Commit 7747c2a

Browse files
committed
use input/output events from syncline
1 parent a896ebf commit 7747c2a

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

lib/node/node-wsh.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export class WindowsScriptingHost extends EventEmitter {
1212
const command = options.command || COMMAND;
1313
const args = options.args || ARGS;
1414
const scriptFile = options.scriptFile || SCRIPT_FILE;
15-
const trace = options.trace || 0;
16-
return new WindowsScriptingHost( await Syncline.spawn( command, [ ...args, scriptFile], { trace}));
15+
return new WindowsScriptingHost( await Syncline.spawn( command, [ ...args, scriptFile], options.syncline), options);
1716
}
1817

1918
#syncline;
@@ -22,11 +21,15 @@ export class WindowsScriptingHost extends EventEmitter {
2221
#ref2proxy = new Map(); // Map< string, WeakRef< Proxy | <custom-mapped>>>
2322
#proxy2ref = new WeakMap(); // Map< Proxy | <custom-mapped>, string>
2423

25-
constructor( syncline) {
24+
constructor( syncline, options) {
2625
super();
2726
this.#syncline = syncline;
2827
this.#syncline.on( 'stderr', line => console.log( 'wsh-stderr:', line));
2928
this.#syncline.on( 'stdout', line => console.log( 'wsh-stdout:', line));
29+
if( options.printSynclineIO) {
30+
this.#syncline.on( 'input', line => console.log( 'syncline-input:', line));
31+
this.#syncline.on( 'output', line => console.log( 'syncline-output', line));
32+
}
3033
}
3134

3235
get remoteObjects() {

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@arcticnotes/node-wsh",
3-
"version": "0.0.11",
3+
"version": "0.0.12",
44
"description": "A Node.js package that runs Windows Scripting Host (WSH) as a child process and exposes the resources from the WSH world to the Node.js world",
55
"author": "Paul <paul@arcticnotes.com>",
66
"license": "MIT",
@@ -21,7 +21,7 @@
2121
".": "./lib/index.js"
2222
},
2323
"dependencies": {
24-
"@arcticnotes/syncline": "0.0.3"
24+
"@arcticnotes/syncline": "0.0.4"
2525
},
2626
"files": [
2727
"/lib/"

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import TEST from 'node:test';
33
import { WindowsScriptingHost} from '@arcticnotes/node-wsh';
44

55
TEST( 'smoke-test', async() => {
6-
const wsh = await WindowsScriptingHost.connect();
6+
const wsh = await WindowsScriptingHost.connect( { printSynclineIO: true});
77
try {
88
wsh.on( 'ref', ( ref, obj) => console.log( 'ref', ref, obj));
99
wsh.on( 'unref', ref => console.log( 'unref', ref));
@@ -29,7 +29,7 @@ TEST( 'smoke-test', async() => {
2929
});
3030

3131
TEST( 'vbarray', async() => {
32-
const wsh = await WindowsScriptingHost.connect();
32+
const wsh = await WindowsScriptingHost.connect( { printSynclineIO: true});
3333
try {
3434
const CreateVBArray = wsh.global( 'CreateVBArray');
3535
ASSERT.equal( typeof CreateVBArray( [ 1, 3, 5]), 'function');

0 commit comments

Comments
 (0)