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

scripts do not work under Windows (pre / post launch) #4248

Open
ZashIn opened this issue Jan 6, 2025 · 0 comments
Open

scripts do not work under Windows (pre / post launch) #4248

ZashIn opened this issue Jan 6, 2025 · 0 comments
Labels
bug:unconfirmed Someone works on identifying the issue

Comments

@ZashIn
Copy link

ZashIn commented Jan 6, 2025

Describe the bug

Setting up a script under Windows (a .bat or .ps1 script, e.g. C:\test.bat) to run before a game is launched does not work, preventing the game from launching without any usable feedback or log entry.

Cause

child_process.spawn(scriptPath, ...) (see here) does not launch a script file under Windows directly.
Instead one would have to invoke the script interpreter and pass the script as an argument e.g. child_process.spawn('cmd', ['/c', scriptPath]).

Solution

Either:

  • add an option for script arguments, child_process.spawn(scriptPath, scriptArguments)
    e.g. child_process.spawn('cmd', ['/c', 'C:\\test.bat'])
  • use child_process.exec(scripPath) instead, e.g. child_process.exec('cmd /c C:\\test.bat')

Add logs

Launching "<game name>" (legendary)
Native? Yes
Installed in: <game path>

System Info:
...
OS: Microsoft Windows 10 Education N 10.0.19045 (win32)

The current system is not a Steam Deck
We are not running inside a Flatpak container

Software Versions:
  Heroic: 2.15.2 Emeth
  Legendary: 0.20.36 Urban Flight (Heroic)
  gogdl: 1.1.2
  comet: comet 0.1.2

  Nile: 1.1.2 Will A. Zeppeli

Game Settings: {
	...
	"beforeLaunchScriptPath": "C:\\test.bat",
	"afterLaunchScriptPath": ""
}

Game launched at: <time>

Steps to reproduce

Under Windows in Heroic:

  1. Right click any game
  2. Click on Settings
  3. Under "Scripts: Select a script to run before the game is launched" enter or select a .bat or .ps1 script
  4. Close settings window
  5. Launch the game
  6. Game does not launch, Status is stuck at "Launching"

Expected behavior

Script and game is run by Heroic

Heroic Version

Latest Stable

System Information

  • OS: Windows 10
  • Heroic: 2.15.2

Additional information

Running e.g. a compiled AutoHotkey script does also not work, since Heroic waits for the script to close, which a hotkey script does obviously not do.

@ZashIn ZashIn added the bug:unconfirmed Someone works on identifying the issue label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unconfirmed Someone works on identifying the issue
Projects
None yet
Development

No branches or pull requests

1 participant