我想执行一项持续时间超过1小时(大概6小时或更长时间)的gulp任务 此刻,一小时后,我收到了这条消息:
[00:32:53] 'my-long-running-task' errored after 1 h
[00:32:53] Error: Timeout
...
at module.exports (C:\myproject\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\myproject\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\myproject\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\myproject\node_modules\orchestrator\index.js:134:8)
at C:\Users\user1\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^3.7.0\index.js:72:20
at _combinedTickCallback (internal/process/next_tick.js:67:7)
任务未被完全杀死(已启动的进程继续运行),但任务的其他步骤未执行。
你知道我怎么能提高这一小时的超时时间?或完全删除它?
答案 0 :(得分:0)
我找到了解决方案: 在gulp我使用sync-exec并且它有一个maxWait参数。
'use strict';
const gulp = require('gulp');
const exec = require('sync-exec');
gulp.task('my-task', () => {
let maxWaitValue = 24 * 60 * 60 * 1000;
exec(`my task which takes very long`, maxWaitValue, config.execSyncOptions);
});