Skip to content

Status code "0" when XML file passed to the command does not exist. #73

@elenachavdarova

Description

@elenachavdarova

Summary:

If the file passed to the command does not exists no errors are being returned and status code is 0.

When a script is using wp cli import it needs to get the status code from the command execution. There is no error/warning returned when the passed file is missing.

Steps to reproduce the bug

  • Execute the command with missing file path passed to it.
wp import missing_file.xml --authors=skip

Results and impacts

Result:

$ wp import missing_file.xml --authors=skip
Starting the import process...
$ echo $?
0

Expected Results:

Expecting to have an error returned with status code different from 0.

Environment

$ wp cli info
OS:	Linux 3.12.18-clouder0 #2 SMP PREEMPT Mon Mar 7 20:55:37 EET 2022 x86_64
Shell:	/bin/bash
PHP binary:	/usr/local/php74/bin/php-cli
PHP version:	7.4.28
php.ini used:	/usr/local/php74/lib/php.ini
MySQL binary:	/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions