我在Electron中打包了Angular 2应用程序。我想知道是否可以从该应用程序运行shell脚本。
谢谢你的帮助。
我能够使用ngx-childprocess实现这一点
分3个步骤:
yarn add ngx-childprocess
or
npm install ngx-childprocess --save
imports: [
NgxChildProcessModulem
....
import { ChildProcessService } from 'ngx-childprocess';
...
export class AppComponent {
constructor(private childProcessService: ChildProcessService) {
console.log('isElectronApp ' + childProcessService.isElectronApp);
let options: string[] = [];
childProcessService.childProcess.exec('java -jar child-process-test-1.0.jar',
options,
(data) => {console.log(data);});
}
}