… | |
… | |
1364 | Works like the combination of the C<fork>/C<exec> builtins, which executes |
1364 | Works like the combination of the C<fork>/C<exec> builtins, which executes |
1365 | ("starts") programs in the background. This function takes care of setting |
1365 | ("starts") programs in the background. This function takes care of setting |
1366 | the user environment before exec'ing the command (e.g. C<PATH>) and should |
1366 | the user environment before exec'ing the command (e.g. C<PATH>) and should |
1367 | be preferred over explicit calls to C<exec> or C<system>. |
1367 | be preferred over explicit calls to C<exec> or C<system>. |
1368 | |
1368 | |
|
|
1369 | It also sets the C<URXVT_EXT_WINDOWID> environment variable to the window |
|
|
1370 | ID of the terminal (C<< $self->parent >>), similar to the C<WINDOWID> |
|
|
1371 | variable set for the process spawned inside the terminal. |
|
|
1372 | |
1369 | Returns the pid of the subprocess or C<undef> on error. |
1373 | Returns the pid of the subprocess or C<undef> on error. |
1370 | |
1374 | |
1371 | =cut |
1375 | =cut |
1372 | |
1376 | |
1373 | sub exec_async { |
1377 | sub exec_async { |
… | |
… | |
1376 | my $pid = fork; |
1380 | my $pid = fork; |
1377 | |
1381 | |
1378 | return $pid |
1382 | return $pid |
1379 | if !defined $pid or $pid; |
1383 | if !defined $pid or $pid; |
1380 | |
1384 | |
|
|
1385 | %ENV = ( |
1381 | %ENV = %{ $self->env }; |
1386 | %{ $self->env }, |
|
|
1387 | URXVT_EXT_WINDOWID => $self->parent, |
|
|
1388 | ); |
1382 | |
1389 | |
1383 | exec @_; |
1390 | exec @_; |
1384 | urxvt::_exit 255; |
1391 | urxvt::_exit 255; |
1385 | } |
1392 | } |
1386 | |
1393 | |