3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

Improve launching of modules

If a `workdir` factoid key is present, the launcher will chdir
to make the specified value the current working directory.

Redirect stderr output to a $modulename-stderr in the module's
current working directory.
This commit is contained in:
Pragmatic Software 2015-01-27 23:49:30 -08:00
parent 56a926603f
commit 12cd9cb8e0

View File

@ -142,9 +142,11 @@ sub execute_module {
Carp::croak("Could not chdir to '$module_dir': $!");
}
# $self->{pbot}->{logger}->log("module arguments: [$arguments]\n");
if(exists $self->{pbot}->{factoids}->{factoids}->hash->{$channel}->{$trigger}->{workdir}) {
chdir $self->{pbot}->{factoids}->{factoids}->hash->{$channel}->{$trigger}->{workdir};
}
$text = `$module_dir/$module $arguments`;
$text = `./$module $arguments 2>> $module-stderr`;
if(defined $tonick) {
$self->{pbot}->{logger}->log("($from): $nick!$user\@$host) sent to $tonick\n");