mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Add the option of passing environment variables to the connection
This commit is contained in:
parent
cc376a4b31
commit
fdb76683b2
1 changed files with 3 additions and 2 deletions
|
|
@ -23,17 +23,18 @@ class RawConnection {
|
||||||
private $process;
|
private $process;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($command) {
|
public function __construct($command, $env = array()) {
|
||||||
$descriptorSpec = array(
|
$descriptorSpec = array(
|
||||||
0 => array("pipe", "r"),
|
0 => array("pipe", "r"),
|
||||||
1 => array("pipe", "w"),
|
1 => array("pipe", "w"),
|
||||||
2 => array('file', '/dev/null', 'w')
|
2 => array('file', '/dev/null', 'w')
|
||||||
);
|
);
|
||||||
setlocale(LC_ALL, Server::LOCALE);
|
setlocale(LC_ALL, Server::LOCALE);
|
||||||
$this->process = proc_open($command, $descriptorSpec, $this->pipes, null, array(
|
$env = array_merge($env, array(
|
||||||
'CLI_FORCE_INTERACTIVE' => 'y', // Needed or the prompt isn't displayed!!
|
'CLI_FORCE_INTERACTIVE' => 'y', // Needed or the prompt isn't displayed!!
|
||||||
'LC_ALL' => Server::LOCALE
|
'LC_ALL' => Server::LOCALE
|
||||||
));
|
));
|
||||||
|
$this->process = proc_open($command, $descriptorSpec, $this->pipes, null, $env);
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
throw new ConnectionError();
|
throw new ConnectionError();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue