restore() { if (this.state.closed || this.options.show === false) return; let { prompt, after, rest } = this.sections(); let { cursor, initial = '', input = '', value = '' } = this; let size = this.state.size = rest.length; let state = { after, cursor, initial, input, prompt, size, value }; let codes = ansi.cursor.restore(state); if (codes) { this.stdout.write(codes); } }
webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') })
function stylesDev() { return src('./src/assets/css/style.css') .pipe(plumber({ errorHandler: onError })) .pipe(sourcemaps.init()) .pipe(postcss(pluginsListDev)) .pipe(sourcemaps.write('.')) .pipe(dest('./build/wordpress/wp-content/themes/' + themeName)) .pipe(browserSync.stream({ match: '**/*.css' })); }
test('@taskr/clear: filepath (task)', co(function * (t) { t.plan(2); yield create({ * a(f) { const src = `${dir1}/foo`; yield f.$.write(src); t.true('clear' in f, 'attach `clear` to task instance'); yield f.clear(src); t.false(exists(src), 'file was deleted'); } }).start('a'); }));
Promise.coroutine(function * (file, data, opts) { try { file = p.normalize(file); yield mkdir(p.dirname(file)); yield write(file, data, opts); } catch (_) {} })
schnackEvents.on('new-comment', event => { const body = createEmailBody(config, event); try { const sendmail = spawn('sendmail', [notify.sendmail.to]); sendmail.stdin.write(body); sendmail.stdin.end(); } catch (error) { console.error('Error sending sendmail notification:', error); } });
server('/proxy', function (url, req, res) { if (url.query.err !== undefined) { res.writeHead(500); res.end(); return; } res.setHeader("Content-Type", "text/html"); res.write('<div>' + url.query.proxy + '</div>'); res.end(); });
broadcast (message, hotReload = true) { for (const client in this.clients) { this.clients[client].write(JSON.stringify(message)) } return hotReload ? this.codegen.generate('now.js') : undefined }
/** * @param {string} data */ dataAdded(data) { if (data.startsWith('Debugger listening on') || data.startsWith('Debugger attached.') || data.startsWith('Waiting for the debugger to disconnect...')) return; this._terminal.write(data); }
function onauth(type, x, onerror) { Promise.resolve( typeof options.pass === 'function' ? options.pass() : options.pass ).then(pass => socket.write(frontend.auth(type, x, options, pass)) ).catch(onerror) }
constructor(res) { this.data = ''; this.res = res; // Add 2kb padding for IE. const padding = new Array(2049); res.write(`:${padding.join(' ')}\n`); }
Promise.coroutine(function * (file, data, opts) { try { file = p.normalize(file); yield mkdir(p.dirname(file)); yield write(file, data, opts); } catch (_) {} })