rust-cli / team

CLI working group
https://rust-cli.github.io/book
MIT License
294 stars 34 forks source link

failed to resolve: use of undeclared type or module `exitcode` #137

Closed stappersg closed 4 years ago

stappersg commented 4 years ago

Hi,

In-depth topic 2.3 Exit codes has in its example lines like these:

        Ok(_) => {
            println!("Done!");
            std::process::exit(exitcode::OK);
        }

Upon compiling simular lines I do get

error[E0433]: failed to resolve: use of undeclared type or module `exitcode`
  --> src/main.rs:54:28
   |
54 |         std::process::exit(exitcode::OK);
   |                            ^^^^^^^^ use of undeclared type or module `exitcode`

I think the example code needs something like

use std::process::exit;

but adding such line is not enough.

killercup commented 4 years ago

Did you add exitcode as a dependency?

On Fri, 19 Jul 2019, 22:07 Geert Stappers, notifications@github.com wrote:

Hi,

In-depth topic 2.3 Exit codes has in its example lines like these:

    Ok(_) => {
        println!("Done!");
        std::process::exit(exitcode::OK);
    }

Upon compiling simular lines I do get

error[E0433]: failed to resolve: use of undeclared type or module exitcode --> src/main.rs:54:28 | 54 | std::process::exit(exitcode::OK); | ^^^^^^^^ use of undeclared type or module exitcode

I think the example code needs something like

use std::process::exit;

but adding such line is not enough.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rust-lang-nursery/cli-wg/issues/137?email_source=notifications&email_token=AAAE4X324IXTOOOY3VYHUETQAINHHA5CNFSM4IFLOEGKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HALRQUQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAE4X4EY3LXRN6M6C6USK3QAINHHANCNFSM4IFLOEGA .

Dylan-DPC-zz commented 4 years ago

There is no mention of the dependency in the book anywhere. If you can make a PR that adds a note about the dependency used, it will be helpful. Thanks

stappersg commented 4 years ago

If you can make a PR that adds a note about the dependency used, it will be helpful.

There is now merge request #138

Thanks

:-)

stappersg commented 4 years ago

Heart beat request

killercup commented 4 years ago

Fixed by #138