Skip to content

Commit 342f550

Browse files
authored
Merge pull request #10 from caugner/patch-1
Makes CLIClient compatible with Windows
2 parents 7ee6c4d + be1f052 commit 342f550

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Clients/CLIClient.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ public function request($type, $file = null)
7878
// add last argument
7979
if($file)
8080
{
81-
$arguments[] = "'$file'";
81+
$arguments[] = escapeshellarg($file);
8282
}
8383

8484
// build command
85-
$command = ($this->java ?: 'java') . " -jar '{$this->path}' " . implode(' ', $arguments);
85+
$jar = escapeshellarg($this->path);
86+
$command = ($this->java ?: 'java') . " -jar $jar " . implode(' ', $arguments);
8687

8788
// run command
8889
$response = $this->exec($command);
@@ -116,7 +117,8 @@ protected function exec($command)
116117
{
117118
// run command
118119
$exit = -1;
119-
$descriptors = [['pipe', 'r'], ['pipe', 'w'], ['file', '/tmp/tika-error.log', 'a']];
120+
$logfile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tika-error.log';
121+
$descriptors = [['pipe', 'r'], ['pipe', 'w'], ['file', $logfile, 'a']];
120122
$process = proc_open($command, $descriptors, $pipes);
121123
$callback = $this->callback;
122124

0 commit comments

Comments
 (0)