denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
94.04k stars 5.23k forks source link

`Deno.exit` fails to set exit code. #17065

Closed wojpawlik closed 1 year ago

wojpawlik commented 1 year ago
$ deno --version
deno 1.29.0 (release, x86_64-unknown-linux-gnu)
v8 10.9.194.5
typescript 4.9.4
$ cat test.js
Deno.exit(42);
$ deno run test.js
$ echo $?
0

https://github.com/grammyjs/grammY/pull/330

dsherret commented 1 year ago

I'm not able to reproduce.

> cat main.ts
Deno.exit(42);
> deno --version
deno 1.29.0 (release, x86_64-pc-windows-msvc)
v8 10.9.194.5
typescript 4.9.4
V:\scratch2
> deno run main.ts
V:\scratch2
> echo $LastExitCode
42
V:\scratch2
> mv main.ts main.js
V:\scratch2
> deno run main.js
V:\scratch2
> echo $LastExitCode
42
trgwii commented 1 year ago

OS-specific?

dsherret commented 1 year ago

Is there a deno.json in the current or any ancestor directory? (Does it have a lockfile?) It doesn't happen to me on mac either.

wojpawlik commented 1 year ago

Nope, I just reproduced it in /tmp.

dsherret commented 1 year ago

How did you install Deno? Is the command running the executable running via something else? (does calling which deno show the deno executable?)

wojpawlik commented 1 year ago

The problem lies in https://github.com/kt3k/deno-bin @kt3k.