Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XO linting #141

Merged
merged 3 commits into from
Jun 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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