denoland / deno

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

Compile without console #13107

Closed JasperVanEsveld closed 2 years ago

JasperVanEsveld commented 2 years ago

This was mentioned in a comment before It would be nice to have given that webview_deno will (hopefully) be updated soon after deno#12828 was merged Which would allow for electron like applications

One way to do this could be with a command like deno compile --no-console That downloads a deno binary that doesn't use the console, similar to how --target works

Compiling deno without a console can be done by adding: #![windows_subsystem = "windows"] To the top of cli/main.rs Or by passing arguments to rustc

crowlKats commented 2 years ago

Ref https://github.com/denoland/deno/discussions/12941

JasperVanEsveld commented 2 years ago

That may be a better solution, as you don't need 2 windows binaries Though it does feel hacky

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

joao678 commented 1 year ago

I've managed to solve this with a little workaround: take the .exe generated by deno and somehow change the Subsystem flag in the optional headers of the executable, there is a lot of ways to do this, the most pratical for me is using a python script that does this automatically like so

import os
import os.path
import pefile

print('Modifying generated executable subsystem...')
binary = pefile.PE(os.getcwd()+"\\deno_test.exe", fast_load=True)
binary.OPTIONAL_HEADER.Subsystem = 2
binary.write(filename="deno_test.mod.exe")
binary.close()

os.remove("deno_test.exe")
os.rename("deno_test.mod.exe", "deno_test.exe")

You can also use a program like PE Bear to then open the executable in the program, find the optional headers section and change the subsystem manually

svefro commented 1 week ago

this needs to be resolved for us that want to use deno to make small gui apps. like using webUI on windows.

tested python script but got no gui at all then.

bartlomieju commented 1 week ago

You can use --no-console flag with deno compile

svefro commented 1 week ago

You can use --no-console flag with deno compile "unexpected argument '--no-console' found"

The parameter is called "--no-terminal" and does not work as intended. No gui is shown at all on windows. and application exits right away