Skip to content

Commit c708809

Browse files
committed
fix(PTY): Fix Steam Plugin
- Ommit NixOS modification for now. - Add error checking to pty.rs if the command does not exist.
1 parent 2e0443e commit c708809

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

core/systems/launcher/interactive_process.gd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ var logger := Log.get_logger("InteractiveProcess", Log.LEVEL.INFO)
1919

2020
func _init(command: String, cmd_args: PackedStringArray = []) -> void:
2121
# Hack for steam plugin running steamcmd on NixOS
22-
if command.ends_with("steamcmd.sh"):
23-
cmd = "steam-run"
24-
args = PackedStringArray([command])
25-
args.append_array(cmd_args)
26-
return
27-
28-
cmd = command
29-
args = cmd_args
22+
#if command.ends_with("steamcmd.sh"):
23+
#cmd = "steam-run"
24+
#args = PackedStringArray([command])
25+
#args.append_array(cmd_args)
26+
#return
27+
28+
self.cmd = command
29+
self.args = cmd_args
3030

3131

3232
## Start the interactive process

extensions/core/src/system/pty.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,23 @@ impl Pty {
182182
// Spawn a task to run the command
183183
let signals_tx = self.tx.clone();
184184
RUNTIME.spawn(async move {
185-
let mut binding = Command::new(command);
185+
let mut binding = Command::new(command.clone());
186186
let cmd = binding
187187
.args(args)
188188
.stdin(stdin)
189189
.stdout(stdout)
190190
.stderr(stderr);
191-
let child = cmd.spawn().unwrap();
191+
let child = match cmd.spawn() {
192+
Ok(child) => child,
193+
Err(e) => {
194+
log::error!("Failed to spawn child process with command: {command:?} {e:?}");
195+
let signal = Signal::Finished { exit_code: -1 };
196+
if let Err(e) = signals_tx.send(signal) {
197+
log::error!("Error sending exit code: {e:?}");
198+
}
199+
return;
200+
}
201+
};
192202

193203
// Get the PID of the process and emit a started signal
194204
let pid = child.id();

0 commit comments

Comments
 (0)