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

timeout (uu_timeout) for Windows #6200

Open
Azathothas opened this issue Apr 7, 2024 · 1 comment
Open

timeout (uu_timeout) for Windows #6200

Azathothas opened this issue Apr 7, 2024 · 1 comment

Comments

@Azathothas
Copy link

Hi, is it possible to fix timeout (uu_timeout) so that it can also build & work on Windows ?

Currently, it fails:

  Compiling uu_timeout v0.0.26 (C:\Users\runneradmin\AppData\Local\Temp\toolpacks\toolpacks_jpzxhinoezg_AMD64-Windows_NT\coreutils\src\uu\timeout)
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> src\uu\timeout\src/timeout.rs:12:14
   |
12 | use std::os::unix::process::ExitStatusExt;
   |              ^^^^ could not find `unix` in `os`
   |
note: found an item that was configured out
  --> /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\std\src\os\mod.rs:26:9
note: found an item that was configured out
  --> /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\std\src\os\mod.rs:64:9

error[E0432]: unresolved import `uucore::process`
  --> src\uu\timeout\src/timeout.rs:17:13
   |
17 | use uucore::process::ChildExt;
   |             ^^^^^^^ could not find `process` in `uucore`

error[E0432]: unresolved import `uucore::signals`
  --> src\uu\timeout\src/timeout.rs:24:5
   |
24 |     signals::{signal_by_name_or_value, signal_name_by_value},
   |     ^^^^^^^ could not find `signals` in `uucore`

error[E0433]: failed to resolve: could not find `signals` in `uucore`
  --> src\uu\timeout\src/timeout.rs:68:26
   |
68 |             _ => uucore::signals::signal_by_name_or_value("TERM").unwrap(),
   |                          ^^^^^^^ could not find `signals` in `uucore`
   |
note: found an item that was configured out
  --> C:\Users\runneradmin\AppData\Local\Temp\toolpacks\toolpacks_jpzxhinoezg_AMD64-Windows_NT\coreutils\src\uucore\src/lib/lib.rs:77:26
   |
77 | pub use crate::features::signals;
   |                          ^^^^^^^

error[E0433]: failed to resolve: could not find `sys` in `nix`
   --> src\uu\timeout\src/timeout.rs:185:14
    |
185 |         nix::sys::signal::signal(
    |              ^^^ could not find `sys` in `nix`

error[E0433]: failed to resolve: could not find `sys` in `nix`
   --> src\uu\timeout\src/timeout.rs:186:18
    |
186 |             nix::sys::signal::Signal::SIGCHLD,
    |                  ^^^ could not find `sys` in `nix`

error[E0433]: failed to resolve: could not find `sys` in `nix`
   --> src\uu\timeout\src/timeout.rs:187:18
    |
187 |             nix::sys::signal::SigHandler::SigDfl,
    |                  ^^^ could not find `sys` in `nix`

error[E0425]: cannot find function `setpgid` in crate `libc`
   --> src\uu\timeout\src/timeout.rs:302:24
    |
302 |         unsafe { libc::setpgid(0, 0) };
    |                        ^^^^^^^ help: a function with a similar name exists: `getpid`
    |
   ::: C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libc-0.2.153\src\windows\mod.rs:491:5
    |
491 |     pub fn getpid() -> ::c_int;
    |     -------------------------- similarly named function `getpid` defined here

error[E0599]: no method named `send_signal` found for mutable reference `&mut Child` in the current scope
   --> src\uu\timeout\src/timeout.rs:206:25
    |
206 |         let _ = process.send_signal(signal);
    |                         ^^^^^^^^^^^ method not found in `&mut Child`

error[E0599]: no method named `send_signal_group` found for mutable reference `&mut Child` in the current scope
   --> src\uu\timeout\src/timeout.rs:208:25
    |
208 |         let _ = process.send_signal_group(signal);
    |                         ^^^^^^^^^^^^^^^^^ method not found in `&mut Child`

error[E0599]: no method named `send_signal_group` found for mutable reference `&mut Child` in the current scope
   --> src\uu\timeout\src/timeout.rs:212:25
    |
212 |             _ = process.send_signal_group(continued_signal);
    |                         ^^^^^^^^^^^^^^^^^ method not found in `&mut Child`

error[E0599]: no method named `wait_or_timeout` found for mutable reference `&mut Child` in the current scope
   --> src\uu\timeout\src/timeout.rs:245:19
    |
245 |     match process.wait_or_timeout(duration) {
    |                   ^^^^^^^^^^^^^^^ method not found in `&mut Child`

error[E0599]: no method named `wait_or_timeout` found for mutable reference `&mut Child` in the current scope
   --> src\uu\timeout\src/timeout.rs:335:19
    |
335 |     match process.wait_or_timeout(duration) {
    |                   ^^^^^^^^^^^^^^^ method not found in `&mut Child`

error[E0599]: no method named `signal` found for struct `std::process::ExitStatus` in the current scope
   --> src\uu\timeout\src/timeout.rs:349:57
    |
349 |                         } else if let Some(sc) = status.signal() {
    |                                                         ^^^^^^ method not found in `ExitStatus`

Some errors have detailed explanations: E0425, E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `uu_timeout` (lib) due to 14 previous errors
@Azathothas
Copy link
Author

Not sure if this helps,
but busybox-w32 already has timeout : https://github.com/rmyorston/busybox-w32/blob/master/coreutils/timeout.c
I tested and that one works, so hopefully, it should be trivial to patch https://github.com/uutils/coreutils/tree/main/src/uu/timeout as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants