generator a child process and pass parameter by stdout/stdin
diff --git a/out/src/extension.js b/out/src/extension.js
new file mode 100644
index 0000000..846428b
--- /dev/null
+++ b/out/src/extension.js
@@ -0,0 +1,38 @@
+'use strict';
+// The module 'vscode' contains the VS Code extensibility API
+// Import the module and reference it with the alias vscode in your code below
+var vscode = require('vscode');
+var child_process = require('child_process');
+// this method is called when your extension is activated
+// your extension is activated the very first time the command is executed
+function activate(context) {
+ // Use the console to output diagnostic information (console.log) and errors (console.error)
+ // This line of code will only be executed once when your extension is activated
+ console.log('Congratulations, your extension "previewtest-ts" is now active!');
+ var spawn = child_process.spawn('E:\\Docfx\\test\\extensionTest\\previewTest\\child.exe');
+ // The command has been defined in the package.json file
+ // Now provide the implementation of the command with registerCommand
+ // The commandId parameter must match the command field in package.json
+ var disposable = vscode.commands.registerCommand('extension.sayHello', function () {
+ // The code you place here will be executed every time your command is executed
+ spawn.stdin.write("t-jipe\n");
+ // Display a message box to the user
+ vscode.window.showInformationMessage('Hello World!');
+ });
+ spawn.stdout.on('data', function (data) {
+ console.log("result " + data + '\n');
+ });
+ spawn.stderr.on('data', function (data) {
+ console.log("error " + data + '\n');
+ });
+ spawn.on('exit', function (code) {
+ console.log('child process exit with code ' + code);
+ });
+ context.subscriptions.push(disposable);
+}
+exports.activate = activate;
+// this method is called when your extension is deactivated
+function deactivate() {
+}
+exports.deactivate = deactivate;
+//# sourceMappingURL=extension.js.map
\ No newline at end of file
diff --git a/out/src/extension.js.map b/out/src/extension.js.map
new file mode 100644
index 0000000..6bd7689
--- /dev/null
+++ b/out/src/extension.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,6DAA6D;AAC7D,8EAA8E;AAC9E,IAAY,MAAM,WAAM,QAAQ,CAAC,CAAA;AACjC,IAAY,aAAa,WAAM,eAAe,CAAC,CAAA;AAE/C,yDAAyD;AACzD,0EAA0E;AAC1E,kBAAyB,OAAgC;IAErD,4FAA4F;IAC5F,gFAAgF;IAChF,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;IAE/E,IAAI,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAE1F,wDAAwD;IACxD,sEAAsE;IACtE,uEAAuE;IACvE,IAAI,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,oBAAoB,EAAE;QACnE,+EAA+E;QAE/E,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9B,oCAAoC;QACpC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAG,UAAS,IAAI;QAClC,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAG,UAAS,IAAI;QAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAG,UAAS,IAAI;QAC3B,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAhCe,gBAAQ,WAgCvB,CAAA;AAED,2DAA2D;AAC3D;AACA,CAAC;AADe,kBAAU,aACzB,CAAA"}
\ No newline at end of file
diff --git a/out/test/extension.test.js b/out/test/extension.test.js
new file mode 100644
index 0000000..bfd0701
--- /dev/null
+++ b/out/test/extension.test.js
@@ -0,0 +1,16 @@
+//
+// Note: This example test is leveraging the Mocha test framework.
+// Please refer to their documentation on https://mochajs.org/ for help.
+//
+"use strict";
+// The module 'assert' provides assertion methods from node
+var assert = require('assert');
+// Defines a Mocha test suite to group tests of similar kind together
+suite("Extension Tests", function () {
+ // Defines a Mocha unit test
+ test("Something 1", function () {
+ assert.equal(-1, [1, 2, 3].indexOf(5));
+ assert.equal(-1, [1, 2, 3].indexOf(0));
+ });
+});
+//# sourceMappingURL=extension.test.js.map
\ No newline at end of file
diff --git a/out/test/extension.test.js.map b/out/test/extension.test.js.map
new file mode 100644
index 0000000..4f77cd2
--- /dev/null
+++ b/out/test/extension.test.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"extension.test.js","sourceRoot":"","sources":["../../test/extension.test.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,kEAAkE;AAClE,wEAAwE;AACxE,EAAE;;AAEF,2DAA2D;AAC3D,IAAY,MAAM,WAAM,QAAQ,CAAC,CAAA;AAOjC,qEAAqE;AACrE,KAAK,CAAC,iBAAiB,EAAE;IAErB,4BAA4B;IAC5B,IAAI,CAAC,aAAa,EAAE;QAChB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/out/test/index.js b/out/test/index.js
new file mode 100644
index 0000000..63797a4
--- /dev/null
+++ b/out/test/index.js
@@ -0,0 +1,20 @@
+//
+// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
+//
+// This file is providing the test runner to use when running extension tests.
+// By default the test runner in use is Mocha based.
+//
+// You can provide your own test runner if you want to override it by exporting
+// a function run(testRoot: string, clb: (error:Error) => void) that the extension
+// host can call to run the tests. The test runner is expected to use console.log
+// to report the results back to the caller. When the tests are finished, return
+// a possible error to the callback or null if none.
+var testRunner = require('vscode/lib/testrunner');
+// You can directly control Mocha options by uncommenting the following lines
+// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
+testRunner.configure({
+ ui: 'tdd',
+ useColors: true // colored output from test results
+});
+module.exports = testRunner;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/out/test/index.js.map b/out/test/index.js.map
new file mode 100644
index 0000000..7775825
--- /dev/null
+++ b/out/test/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../test/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,8EAA8E;AAC9E,oDAAoD;AACpD,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,oDAAoD;AAEpD,IAAI,UAAU,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAElD,6EAA6E;AAC7E,mGAAmG;AACnG,UAAU,CAAC,SAAS,CAAC;IACjB,EAAE,EAAE,KAAK;IACT,SAAS,EAAE,IAAI,CAAC,mCAAmC;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC"}
\ No newline at end of file
diff --git a/src/extension.ts b/src/extension.ts
index 49ce8a4..e1350c5 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -2,6 +2,7 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
+import * as child_process from 'child_process';
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
@@ -11,16 +12,31 @@
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "previewtest-ts" is now active!');
+ var spawn = child_process.spawn('E:\\Docfx\\test\\extensionTest\\previewTest\\child.exe');
+
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
// The code you place here will be executed every time your command is executed
+ spawn.stdin.write("t-jipe\n");
// Display a message box to the user
vscode.window.showInformationMessage('Hello World!');
});
+ spawn.stdout.on('data' , function(data){
+ console.log("result " + data + '\n');
+ });
+
+ spawn.stderr.on('data' , function(data){
+ console.log("error " + data + '\n');
+ });
+
+ spawn.on('exit' , function(code){
+ console.log('child process exit with code ' + code);
+ })
+
context.subscriptions.push(disposable);
}