Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch output from task to task

Is it possible to switch Gulp's output between tasks?

For example, I'd like to run my build task continuously and see its output by default, and I want to be able to replace build's output with eslint's output, but only if such occurs. So, I can see build's output again, if all offences are corrected.

Seemed pretty straightforward before I started to tinker. Am I missing something?

like image 952
askhat Avatar asked Aug 09 '17 13:08

askhat


People also ask

How do I switch tasks in Windows 10?

Select the Task View icon on the taskbar, or press Alt-Tab on your keyboard to see apps or switch between them. To use two or more apps at a time, grab the top of an app window and drag it to the side. Then choose another app and it'll automatically snap into place.

Why do I keep switching between tasks?

Context switching happens when your schedule is either too full (too many things to work on) or too empty (not enough structure to stay focused). Habits. Most of us have built a habit of task switching through how we use work tools like email or chat. Routines and rituals.

What is task output?

Task output is the data that passes from a task into workflow variables. When you configure a task, you specify the task output values that you want to assign to workflow variables.


1 Answers

Not a proper solution. But here's an idea.

var originalStdoutWrite = process.stdout.write;
process.stdout.write = function(){ return; }
gulp.src(['**/*.js','!node_modules/**'])
    .pipe(eslint())
    .pipe(eslint.results(results => {
        // Called once for all ESLint results.
        if(results.errorCount>0){
            originalStdoutWrite.call(process.stdout,`Total Results: ${results.length}`);
        }else{
            process.stdout.write = originalStdoutWrite;
        }
    }));
like image 174
Sibin Avatar answered Oct 05 '22 13:10

Sibin