Skip to content

Commit

Permalink
[DOP-4033]: Check array length
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Oct 19, 2023
1 parent 079fe47 commit 0d63308
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/commands/src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function executeAndPipeCommands(
cmdTo.stdin?.on('error', (err: StdinError) => {
// the error event for the cmdTo stdin gets called whenever it closes prematurely,
// but this is expected in certain situations e.g. when using the `yes` command.
// If this condition is met, we know that this expected, and ignore it otherwise we throw.
// If this condition is met, we know that this expected and ignore it otherwise we throw.
// If we don't check, we get an unhandled error exception.
if (err.code === EPIPE_CODE && err.syscall === EPIPE_SYSCALL && err.errno === EPIPE_ERRNO) {
console.log('stdin done');
Expand Down Expand Up @@ -119,11 +119,11 @@ export async function executeAndPipeCommands(
console.error('Arguments provided: ', cmdToParams.args);
console.error('Options provided: ', cmdToParams.options);

if (outputText) {
console.error('output', outputText.join(''));
if (outputText.length) {
console.log('output', outputText.join(''));
}

if (errorText) {
if (errorText.length) {
console.error('error', errorText.join(''));
}

Expand Down Expand Up @@ -185,11 +185,11 @@ export async function executeCliCommand({
console.error('Arguments provided: ', args);
console.error('Options provided: ', options);

if (outputText) {
if (outputText.length) {
console.log(outputText.join(''));
}

if (errorText) {
if (errorText.length) {
console.error(errorText.join(''));
}

Expand Down

0 comments on commit 0d63308

Please sign in to comment.