Skip to content

Commit

Permalink
Fix XO linting (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicdoe authored and sindresorhus committed Jun 22, 2018
1 parent 7e4d44c commit 7488ce9
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ function handleArgs(cmd, args, opts) {
};
}

function handleInput(spawned, opts) {
const input = opts.input;

function handleInput(spawned, input) {
if (input === null || input === undefined) {
return;
}
Expand Down Expand Up @@ -143,15 +141,12 @@ function getStream(process, stream, encoding, maxBuffer) {
}

function makeError(result, options) {
const stdout = result.stdout;
const stderr = result.stderr;
const {stdout, stderr} = result;

let err = result.error;
const code = result.code;
const signal = result.signal;
const {code, signal} = result;

const parsed = options.parsed;
const joinedCmd = options.joinedCmd;
const {parsed, joinedCmd} = options;
const timedOut = options.timedOut || false;

if (!err) {
Expand Down Expand Up @@ -195,8 +190,7 @@ function joinCmd(cmd, args) {

module.exports = (cmd, args, opts) => {
const parsed = handleArgs(cmd, args, opts);
const encoding = parsed.opts.encoding;
const maxBuffer = parsed.opts.maxBuffer;
const {encoding, maxBuffer} = parsed.opts;
const joinedCmd = joinCmd(cmd, args);

let spawned;
Expand Down Expand Up @@ -306,22 +300,22 @@ module.exports = (cmd, args, opts) => {

crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);

handleInput(spawned, parsed.opts);
handleInput(spawned, parsed.opts.input);

spawned.then = (onfulfilled, onrejected) => handlePromise().then(onfulfilled, onrejected);
spawned.catch = onrejected => handlePromise().catch(onrejected);

return spawned;
};

module.exports.stdout = function () {
module.exports.stdout = function (...args) {
// TODO: set `stderr: 'ignore'` when that option is implemented
return module.exports.apply(null, arguments).then(x => x.stdout);
return module.exports(...args).then(x => x.stdout);
};

module.exports.stderr = function () {
module.exports.stderr = function (...args) {
// TODO: set `stdout: 'ignore'` when that option is implemented
return module.exports.apply(null, arguments).then(x => x.stderr);
return module.exports(...args).then(x => x.stderr);
};

module.exports.shell = (cmd, opts) => handleShell(module.exports, cmd, opts);
Expand Down

0 comments on commit 7488ce9

Please sign in to comment.