Skip to content

Commit 330c348

Browse files
committed
extra readline check to make sure -a works
1 parent b9dfb5a commit 330c348

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/SPC/builder/Extension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function runCliCheckUnix(): void
298298
// Run compile check if build target is cli
299299
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
300300
$sharedExtensions = $this->getSharedExtensionLoadString();
301-
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
301+
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"');
302302
if ($ret !== 0) {
303303
throw new ValidationException(
304304
"extension {$this->getName()} failed compile check: php-cli returned {$ret}",
@@ -328,7 +328,7 @@ public function runCliCheckWindows(): void
328328
{
329329
// Run compile check if build target is cli
330330
// If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php
331-
[$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n --ri "' . $this->getDistName() . '"', false);
331+
[$ret] = cmd()->execWithResult(BUILD_BIN_PATH . '/php.exe -n --ri "' . $this->getDistName() . '"', false);
332332
if ($ret !== 0) {
333333
throw new ValidationException("extension {$this->getName()} failed compile check: php-cli returned {$ret}", validation_module: "Extension {$this->getName()} sanity check");
334334
}

src/SPC/builder/extension/readline.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace SPC\builder\extension;
66

77
use SPC\builder\Extension;
8+
use SPC\exception\ValidationException;
89
use SPC\store\FileSystem;
910
use SPC\util\CustomExt;
1011
use SPC\util\SPCTarget;
@@ -36,6 +37,15 @@ public function buildUnixShared(): void
3637
parent::buildUnixShared();
3738
}
3839

40+
public function runCliCheckUnix(): void
41+
{
42+
parent::runCliCheckUnix();
43+
[$ret, $out] = shell()->execWithResult('printf "exit\n" | ' . BUILD_BIN_PATH . '/php -a');
44+
if ($ret !== 0 || !str_contains(implode("\n", $out), 'Interactive shell')) {
45+
throw new ValidationException("readline extension failed sanity check. Code: {$ret}, output: " . implode("\n", $out));
46+
}
47+
}
48+
3949
public static function patchCliLinux(bool $patch): void
4050
{
4151
if (SPCTarget::getTargetOS() === 'Linux' && SPCTarget::isStatic() && $patch) {

0 commit comments

Comments
 (0)