I have Angular 2 app packaged in Electron. I wonder if it is possible to run shell script from that app.
Thanks for any help.
I was able to achieve that using ngx-childprocess
In 3 steps:
in your electron/angular app install ngx-childprocess
yarn add ngx-childprocess
or
npm install ngx-childprocess --save
add gx-childprocess into app.module
imports: [
NgxChildProcessModulem
....
run the script (in this case I am running java jar)
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);});
}
}