Fix command argument handling in system command execution
This commit is contained in:
parent
2f002b9735
commit
5a8fb2e725
1 changed files with 2 additions and 2 deletions
|
@ -46,7 +46,7 @@ sub handle {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if it's a system command
|
# Check if it's a system command
|
||||||
my ($cmd_name) = split(/\s+/, $command);
|
my ($cmd_name, @args) = split(/\s+/, $command);
|
||||||
#print STDERR "DEBUG: Checking system command: $cmd_name\n";
|
#print STDERR "DEBUG: Checking system command: $cmd_name\n";
|
||||||
|
|
||||||
# Check PATH directly
|
# Check PATH directly
|
||||||
|
@ -56,7 +56,7 @@ sub handle {
|
||||||
my $pid = fork();
|
my $pid = fork();
|
||||||
die "Fork failed: $!" unless defined $pid;
|
die "Fork failed: $!" unless defined $pid;
|
||||||
if ($pid == 0) { # Child
|
if ($pid == 0) { # Child
|
||||||
exec($full_path, split(/\s+/, $command)) or die "Exec failed: $!";
|
exec($full_path, @args) or die "Exec failed: $!";
|
||||||
}
|
}
|
||||||
waitpid($pid, 0); # Wait for child
|
waitpid($pid, 0); # Wait for child
|
||||||
return 2;
|
return 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue