mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 03:31:31 +00:00
updated streamline-setup v2
This commit is contained in:
+13
-5
@@ -346,7 +346,7 @@ class Process implements \IteratorAggregate
|
||||
|
||||
$process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
|
||||
|
||||
if (!\is_resource($process)) {
|
||||
if (!$process) {
|
||||
throw new RuntimeException('Unable to launch a new process.');
|
||||
}
|
||||
$this->process = $process;
|
||||
@@ -1211,7 +1211,7 @@ class Process implements \IteratorAggregate
|
||||
{
|
||||
static $isTtySupported;
|
||||
|
||||
return $isTtySupported ??= ('/' === \DIRECTORY_SEPARATOR && stream_isatty(\STDOUT));
|
||||
return $isTtySupported ??= ('/' === \DIRECTORY_SEPARATOR && stream_isatty(\STDOUT) && @is_writable('/dev/tty'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1400,8 +1400,9 @@ class Process implements \IteratorAggregate
|
||||
private function close(): int
|
||||
{
|
||||
$this->processPipes->close();
|
||||
if (\is_resource($this->process)) {
|
||||
if ($this->process) {
|
||||
proc_close($this->process);
|
||||
$this->process = null;
|
||||
}
|
||||
$this->exitcode = $this->processInformation['exitcode'];
|
||||
$this->status = self::STATUS_TERMINATED;
|
||||
@@ -1535,7 +1536,14 @@ class Process implements \IteratorAggregate
|
||||
$cmd
|
||||
);
|
||||
|
||||
$cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
|
||||
static $comSpec;
|
||||
|
||||
if (!$comSpec && $comSpec = (new ExecutableFinder())->find('cmd.exe')) {
|
||||
// Escape according to CommandLineToArgvW rules
|
||||
$comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec) .'"';
|
||||
}
|
||||
|
||||
$cmd = ($comSpec ?? 'cmd').' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
|
||||
foreach ($this->processPipes->getFiles() as $offset => $filename) {
|
||||
$cmd .= ' '.$offset.'>"'.$filename.'"';
|
||||
}
|
||||
@@ -1581,7 +1589,7 @@ class Process implements \IteratorAggregate
|
||||
if (str_contains($argument, "\0")) {
|
||||
$argument = str_replace("\0", '?', $argument);
|
||||
}
|
||||
if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
|
||||
if (!preg_match('/[()%!^"<>&|\s]/', $argument)) {
|
||||
return $argument;
|
||||
}
|
||||
$argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);
|
||||
|
||||
Reference in New Issue
Block a user