Skip to content

JS error() gives string whereas SH $? gives int #45

@sam-maverick

Description

@sam-maverick

Input (bash) code

some command
RESULT=$?
if [ $RESULT != 0 ]; then
    echo "Aborting on $RESULT, command failed:"
    exit $RESULT
fi

Expected output ShellJS (JavaScript) code

exec('some command');
env.RESULT = (error()=='null' ? 0 : 1);
if (env.RESULT !== 0) {
  echo('Aborting on ' + env.RESULT + ', command failed:');
  exit(env.RESULT);
}

Actual output ShellJS (JavaScript) code

exec('some command');
env.RESULT = error();
if (env.RESULT !== 0) {
  echo('Aborting on ' + env.RESULT + ', command failed:');
  exit(env.RESULT);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions