-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
The problem occurs because the child gulp script requires working directory change:
gulp --gulpfile "<...>\gulpfile.js" build
[13:40:01] Working directory changed to <...>
[13:40:03] Using gulpfile <...>\gulpfile.js
[13:40:03] Starting 'build'...
[13:40:03] Finished 'build' after 6.42 μs
This works:
const cp = require('cp');
gulp.task('gg2', function (done) {
var gulpfile = path.join(gulpcwd, 'gulpfile.js');
var subShell = cp.spawn('cmd.exe', ['/C', 'gulp', '--gulpfile', gulpfile, '--cwd', gulpcwd, 'build'], {
env: process.env,
cwd: process.cwd()
});
subShell.stdout.pipe(process.stdout);
subShell.stderr.pipe(process.stderr);
subShell.once('exit', function (code) {
done(code);
});
});
This doesn’t work:
const run = require('gulp-run');
gulp.task('gg2', function (done) {
var gulpfile = path.join(gulpcwd, 'gulpfile.js');
return run('gulp --gulpfile "' + gulpfile + '" --cwd "' + gulpcwd + '" build', { verbosity: 3 })
.exec(function (err) {
done(err);
});
});
In latter case the child process sends a standard gulp error that the gulp file is not found.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels