我有一个正常.ts格式的程序
var spawn = require('child_process').spawn;
var child = spawn("dir",{shell:true});
child.stdout.on("data",function(data){
console.log('data\n ' + data);});
但是当我使用vscode扩展模块时。
function activate(context) {
console.log('Congratulations, your extension "helloworld-minimal-sample" is now active!');
var spawn = require('child_process').spawnSync;
var child = spawn("dir",{shell:true});
child.stdout.on("data",function(data){
console.log('data\n ' + data);
});
console.log('stdout here: \n' + child.stdout);
let disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
vscode.window.showInformationMessage('Hello World!');
});
context.subscriptions.push(disposable);
}
但这不显示目录。 如何解决?