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

repl: "run" command with -ofmt=c causes an access denied error #8827

Closed
andrewrk opened this issue May 18, 2021 · 2 comments
Closed

repl: "run" command with -ofmt=c causes an access denied error #8827

andrewrk opened this issue May 18, 2021 · 2 comments
Labels
backend-c The C backend (CBE) outputs C source code. bug Observed behavior contradicts documented or intended behavior enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness.

Comments

@andrewrk
Copy link
Member

pub export fn main() c_int {
    return 0;
}
[nix-shell:~/dev/zig/build-release]$ ./zig-out/bin/zig build-exe test.zig -ofmt=c --watch
(zig) run
error: FileBusy
/home/andy/dev/zig/lib/std/child_process.zig:312:9: 0x569672 in std.child_process.ChildProcess.waitPosix (zig)
        return self.term.?;
        ^
/home/andy/dev/zig/lib/std/child_process.zig:177:13: 0x49c0d7 in std.child_process.ChildProcess.wait (zig)
            return self.waitPosix();
            ^
/home/andy/dev/zig/lib/std/child_process.zig:139:9: 0x3b59b1 in std.child_process.ChildProcess.spawnAndWait (zig)
        return self.wait();
        ^
/home/andy/dev/zig/src/main.zig:2182:22: 0x3b4586 in runOrTest (zig)
        const term = try child.spawnAndWait();
                     ^
/home/andy/dev/zig/src/main.zig:2050:21: 0x353efd in buildOutputType (zig)
                    try runOrTest(
                    ^
/home/andy/dev/zig/src/main.zig:186:9: 0x33d227 in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .{ .build = .Exe });
        ^
/home/andy/dev/zig/src/main.zig:141:5: 0x33588b in main (zig)
    return mainArgs(gpa, arena, args);
    ^

This happens because it tries to execute the ".c" file as a child process instead of executing zig run on it.

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness. backend-c The C backend (CBE) outputs C source code. labels May 18, 2021
@andrewrk andrewrk added this to the 0.9.0 milestone May 18, 2021
@g-w1
Copy link
Contributor

g-w1 commented May 18, 2021

Do you want zig run thing.zig -ofmt=c to work? Or only this in the repl?

@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@jacobly0 jacobly0 removed this from the 0.16.0 milestone Feb 9, 2025
@jacobly0
Copy link
Member

jacobly0 commented Feb 9, 2025

The repl has been deleted.

@jacobly0 jacobly0 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-c The C backend (CBE) outputs C source code. bug Observed behavior contradicts documented or intended behavior enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

3 participants