Access Denied OS Error 5 on Windows 7
Henning-K opened this issue · 7 comments
Freshly installed Win7 a few days ago, I have since installed a bunch of stuff for Rust (rustup, rust, some cargo subcommands). However when I tried out cargo watch
after installing it, I got
failed to add to job object: Access denied (OS Error 5)
for some reason...
cargo watch --debug
:
>>> Load Git/VCS ignores: true
>>> Default ignores: ["*\\.DS_Store", "*.swp", "*\\.hg\\*", "*\\.git\\*", "*\\.svn\\*", "*\\target\\*"]
>>> All ignores: ["*\\.DS_Store", "*.swp", "*\\.hg\\*", "*\\.git\\*", "*\\.svn\\*", "*\\target\\*"]
>>> Commands: ["cargo check"]
>>> Watches: ["."]
>>> Watchexec arguments: Args { cmd: "cd F:\\Development\\crate-name && echo [Running \'cargo check\'] && cargo check && echo [Finished running]", paths: ["."], filters: [], ignores: ["*\\.DS_Store", "*.swp", "*\\.hg\\*", "*\\.git\\*", "*\\.svn\\*", "*\\target\\*"], clear_screen: false, signal: None, restart: true, debug: true, run_initially: true, no_shell: false, no_vcs_ignore: false, once: false, poll: false, poll_interval: 1000 }
*** glob converted to regex: Glob { glob: "**/target/**", re: "(?-u)^(?:/?|.*/)target(?:/?|/.*)$", opts: GlobOptions { case_insensitive: false, literal_separator: true }, tokens: Tokens([RecursivePrefix, Literal('t'), Literal('a'), Literal('r'), Literal('g'), Literal('e'), Literal('t'), RecursiveSuffix]) }
*** built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes
*** Loaded "\\\\?\\F:\\Development\\crate-name\\.gitignore"
*** Adding ignore: "*\.DS_Store"
*** Adding ignore: "*.swp"
*** Adding ignore: "*\.hg\*"
*** Adding ignore: "*\.git\*"
*** Adding ignore: "*\.svn\*"
*** Adding ignore: "*\target\*"
*** glob converted to regex: Glob { glob: "*\\.hg\\*", re: "(?-u)^.*/\\.hg/.*$", opts: GlobOptions { case_insensitive: false, literal_separator: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('h'), Literal('g'), Literal('/'), ZeroOrMore]) }
*** glob converted to regex: Glob { glob: "*\\.git\\*", re: "(?-u)^.*/\\.git/.*$", opts: GlobOptions { case_insensitive: false, literal_separator: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('g'), Literal('i'), Literal('t'), Literal('/'), ZeroOrMore]) }
*** glob converted to regex: Glob { glob: "*\\.svn\\*", re: "(?-u)^.*/\\.svn/.*$", opts: GlobOptions { case_insensitive: false, literal_separator: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('s'), Literal('v'), Literal('n'), Literal('/'), ZeroOrMore]) }
*** glob converted to regex: Glob { glob: "*\\target\\*", re: "(?-u)^.*/target/.*$", opts: GlobOptions { case_insensitive: false, literal_separator: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('t'), Literal('a'), Literal('r'), Literal('g'), Literal('e'), Literal('t'), Literal('/'), ZeroOrMore]) }
*** built glob set; 0 literals, 0 basenames, 1 extensions, 0 prefixes, 1 suffixes, 0 required extensions, 4 regexes
*** Watching "\\\\?\\F:\\Development\\crate-name"
*** Assembled command "cmd.exe" "/C" "cd F:\\Development\\crate-name && echo [Running \'cargo check\'] && cargo check && echo [Finished running]"
thread 'main' panicked at 'failed to add to job object: Zugriff verweigert (os error 5)', C:\User
s\name\.cargo\registry\src\github.com-1ecc6299db9ec823\watchexec-1.8.3\src\process.rs:192
note: Run with `RUST_BACKTRACE=1` for a backtrace.
[Running 'cargo check']
Platform:
Windows 7 SP 1
rustc -vV
:
rustc 1.19.0-nightly (f1140a331 2017-05-08)
binary: rustc
commit-hash: f1140a33176a5fb2e91e26ea3ae42a834dd9bfdf
commit-date: 2017-05-08
host: x86_64-pc-windows-msvc
release: 1.19.0-nightly
LLVM version: 4.0
cargo -vV
:
cargo 0.19.0-nightly (fa7584c14 2017-04-26)
release: 0.19.0
commit-hash: fa7584c1495c2d9c04a6416f8e7b546abfa88a52
commit-date: 2017-04-26
Update:
Some talk with WindowsBunny in the #rust-beginners IRC channel revealed that this problem comes Windows 7 not allowing nested jobs which is the case when you invoke this binary with cargo watch
as cargo apparently dispatches the call to the subcommand through a job.
Though the program worked flawlessly for me before on Windows (apparently that was an earlier version).
Before this crate used watchexec it worked perfectly fine for me for months, so I'll file a bug when I have the time, most likely on wednesday(today by now) or thursday.
Yeah, there's definitely tradeoffs. If you don't need the bugfixes / new features we got by using watchexec, you can downgrade to 4.0.3 which is the last non-watchexec version:
cargo install --force --vers 4.0.3
So should this issue remain closed or be reopened as the (underlying) problem is not resolved?
Using cargo watch 4.0.3 is probably the best thing here. There's not much I can do that won't break process watching.
Yeah, I'm going to call it as "not supporting Windows 7 or lower" for cargo watch >= 5. I'll add a mention to the readme.