I was able to implement Splitting gulpfile into multiple file without any issues. Now, my task (below) is moved from ./gulpfile.js to ./tasks/database-publish.js. In this task, I'm using var exec = require('child_process').exec to run a Powershell (PS1) I wrote that lives in ../DbDeploy.ps1 relative to the new gulp-task file.
In this task, I'm executing my ps1 file via gulp
gulp.task("zzz_Run-DB-Deply",
function(callback) {
console.log('running db deploy');
plugins.exec('Powershell.exe -executionpolicy remotesigned -File ..\DbDeploy.ps1',
function (err, stdout, stderr) {
console.log(stdout);
callback(err);
});
});
If I run Powershell.exe -executionpolicy remotesigned -File ..\DbDeploy.ps1 in Powershell from the task directory, it works fine. However, when I run the zzz_Run-DB-Deploy task, I keep getting an exception:
Process terminated with code 0
My suspicion is with ..\DbDeploy.ps1. I think \D is being used as escape character. But I'm not sure. What am I doing wrong?
Powershell.exe -executionpolicy remotesigned -File ..\\DbDeploy.ps1